Reputation: 2025
I'm using UITabBarController in my app. Originally I started the app from SDK 4.3 and then I moved to SDK 5.0. For some reason I need to change my code, to work on the new SDK. So, I changed the code
From this
self.view = tabController.view;
To this
[self.view addSubview:tabController.view];
Now the tabController switch from view to subView it's not aligning properly.
Any help will be appreciated!
Upvotes: 1
Views: 422
Reputation: 2737
The UITabBarController should be use directly on the UIWindow, the gap you're seeing is because it automatically places it self above the status bar.
I think the best solution is to do this in your app delegate:
[window addSubview:[tabController view]];
Or you could change the tabController's view's frame :
tabController.view.frame = CGRectOffset(tabController.view.frame, 0, -20)
[self.view addSubview:tabController.view];
The magic 20 is the height of the status bar.
Upvotes: 1