UITabBarController + UINavigationController on iPhoneX

Hello!


I'm updating our app for iPhoneX design. App is quite old and all core is made programmatically.


So in AppDelegate i create my own tabbarcontroller add to it necessary uinavigationcontrollers and then set is as root controller.


Problem is that even after changing all requirements for iPhoneX design it seems that still runs in some sort of compatibility mode.


Deployment Target is 9.0

Base SDK is 11.1


I have enabled Auto Layout and Safe area guidelines for my UINavigationController in XIB file. For TabController I don't have XIB file.

(for info i have WatchApp extension Deployment Target is 2.0 - hope it doesn't affect)


Screen looks like this.

I hope that I don't need to update my project structure so it uses Storyboard or something like that, because it's like full overhaul of application.


For info. I made a test app with just one tab and storyboard and it looks perfectly on iPhone X or iPhone 8.

I'll add some code, maybe it will help more:


This is in appDelegate:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

/

[self initControllers];


return YES;

}


And now initControllers:


-(void)initControllers {

self.tabBarController = [[BasicTabBarController alloc] init];

self.monthCalendarController = [[MonthCalendarController alloc] init];

UINavigationController *monthCalendarNavigationController = [[BasicNavigationController alloc] initWithRootViewController:_monthCalendarController];

SummaryController *summaryController = [[SummaryController alloc] init];

UINavigationController *summaryNavigationController = [[BasicNavigationController alloc] initWithRootViewController:summaryController];

NSArray* controllers = nil;

controllers = [NSArray arrayWithObjects:monthCalendarNavigationController, summaryNavigationController, nil];

_tabBarController.viewControllers = controllers;

/

_window.rootViewController = _tabBarController;

}


BasicTabBarController just extends UITabBarController and is without XIB file.

Code:


@implementation BasicTabBarController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

{

self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

if (self) {

/

NSLog(@"nibNameOrNil: %@", nibNameOrNil);

}

return self;

}

- (void)viewDidLoad

{

[super viewDidLoad];

/

}

-(void)viewWillAppear:(BOOL)animated {

[super viewWillAppear:animated];

}

- (void)didReceiveMemoryWarning

{

[super didReceiveMemoryWarning];

/

}

- (BOOL)shouldAutorotate

{

return [self.selectedViewController shouldAutorotate];

}

- (UIInterfaceOrientationMask)supportedInterfaceOrientations

{

return [self.selectedViewController supportedInterfaceOrientations];

}


Month and Summary is just UIViewControllers with xib files.

BasicNavigationController is UINavigationController.


Hope it gives more info about Safe Area fixes.

It seems that the major problem was that I don't use Storyboards for this app.

I just moved Launchscreen to storyboard, changed main.m so the application call has correct AppDelegate and voila everything works as intended.

UITabBarController + UINavigationController on iPhoneX
 
 
Q