aqsa arshad
aqsa arshad

Reputation: 831

How to change the height of tab bar in iPhone X

I have an app which was previously designed in 2014. Now I have to make the app design compatible with iPhone X.

When i run the app on iPhone X simulator everything works fine except the tab bar. The tab bar height gets increased in iPhone X simulator.

I know the basic safe area guide thing but for now i don't to fill the top and bottom empty areas, i just to display the standard tab bar as it displays on the other iPhones.

enter image description here

The tab bar is added programmatically so i tried to change its height as following

tabBarController = [[UITabBarController alloc] initWithNibName:nil bundle:nil];
self.tabBarController.viewControllers = [[NSArray alloc] initWithObjects:trailsNavController,mapNavController, gpsNavController,infoNavController, signUpNavController, nil];
    self.tabBarController.delegate = self;
self.tabBarController.tabBar.frame = CGRectMake(self.tabBarController.tabBar.frame.origin.x, self.tabBarController.tabBar.frame.origin.y, self.tabBarController.tabBar.frame.size.width, 40);
    self.window.rootViewController = self.tabBarController;

The app design gets distorted when i add splash screen.

enter image description here

Any other way to change its height? Any help would be appreciated.

Upvotes: 0

Views: 954

Answers (2)

aqsa arshad
aqsa arshad

Reputation: 831

So far the only solution i know is Introducing auto layouts.

Upvotes: 1

Alfro
Alfro

Reputation: 1544

You should use proportional height. For example:

self.tabBarController.tabBar.frame = CGRectMake(self.tabBarController.tabBar.frame.origin.x, self.tabBarController.tabBar.frame.origin.y, self.tabBarController.tabBar.frame.size.width, self.view.frame.size.height/6);

Upvotes: 0

Related Questions