Add NavigationController large title support for iOS 11.0

This commit is contained in:
Alexey Chechetkin
2017-10-21 11:08:20 +03:00
parent 964a5ee52d
commit b6c107dff0
8 changed files with 38 additions and 12 deletions

View File

@@ -59,6 +59,7 @@
_serverList = instantiateController( CONTROLLER_ID_SERVERLIST );
UINavigationController *leftNav = [[UINavigationController alloc] initWithRootViewController:_serverList];
preferBigTitleForNavController(leftNav);
UIViewController *rootController = leftNav;
@@ -72,6 +73,7 @@
trc.popoverButtonTitle = NSLocalizedString(@"Servers", @"ServerListController title");//SERVERLIST_CONTROLLER_TITLE;
UINavigationController *rightNav = [[UINavigationController alloc] initWithRootViewController:trc];
preferBigTitleForNavController(rightNav);
UISplitViewController *splitView = [[UISplitViewController alloc] init];
splitView.viewControllers = @[ leftNav, rightNav ];

View File

@@ -29,6 +29,12 @@
/// returns YES if this is iPhone PLUS model on iOS8
BOOL isIPhonePlus(void);
/*!
Set the large title for NavigationBar on iOS11.0+
@param navVC - UINavigationController to set the title
*/
void preferBigTitleForNavController( UINavigationController *navVC );
/*!
Retruns the new instance of UIViewController

View File

@@ -224,3 +224,17 @@ BOOL isIPhonePlus()
return NO;
}
// UINavigationController bit titles prefer
void preferBigTitleForNavController( UINavigationController *navVC )
{
if ( @available(iOS 11.0, *) )
{
navVC.navigationBar.prefersLargeTitles = YES;
navVC.navigationItem.largeTitleDisplayMode = UINavigationItemLargeTitleDisplayModeAutomatic;
}
}

View File

@@ -4,16 +4,16 @@
#import "RPCServerConfig.h"
static NSString *CODER_NAME = @"name";
static NSString *CODER_RPC_PATH = @"path";
static NSString *CODER_USER_NAME = @"username";
static NSString *CODER_USER_PASSWORD = @"pass";
static NSString *CODER_PORT = @"port";
static NSString *CODER_HOST = @"host";
static NSString *CODER_USE_SSL = @"ssl";
static NSString *CODER_REFRESH_TIMEOUT = @"time";
static NSString *CODER_REQUEST_TIMEOUT = @"reqtimeout";
static NSString *CODER_SHOW_FREESPACE = @"showFreeSpace";
static NSString * const CODER_NAME = @"name";
static NSString * const CODER_RPC_PATH = @"path";
static NSString * const CODER_USER_NAME = @"username";
static NSString * const CODER_USER_PASSWORD = @"pass";
static NSString * const CODER_PORT = @"port";
static NSString * const CODER_HOST = @"host";
static NSString * const CODER_USE_SSL = @"ssl";
static NSString * const CODER_REFRESH_TIMEOUT = @"time";
static NSString * const CODER_REQUEST_TIMEOUT = @"reqtimeout";
static NSString * const CODER_SHOW_FREESPACE = @"showFreeSpace";
@implementation RPCServerConfig
@@ -51,6 +51,7 @@ static NSString *CODER_SHOW_FREESPACE = @"showFreeSpace";
{
if( ![_rpcPath hasPrefix:@"/"] )
_rpcPath = [NSString stringWithFormat:@"/%@", _rpcPath];
return [NSString stringWithFormat:@"%@://%@:%i%@", _useSSL ? @"https" : @"http", _host, _port, _rpcPath];
}

View File

@@ -1085,6 +1085,7 @@
_torrentInfoController = instantiateController( CONTROLLER_ID_TORRENTINFO );
_torrentInfoController.torrentId = torrentId;
_torrentInfoController.delegate = self;
_torrentInfoController.title = NSLocalizedString(@"Torrent details", nil);
// we should make a request to RPCConnector
// (upon complite, info controller will be updated)

View File

@@ -9,8 +9,10 @@
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
@autoreleasepool {
int main(int argc, char * argv[])
{
@autoreleasepool
{
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}