Reputation: 21
My problem can be summed on this:
My app have a Navigation bar and a TabBar. When the first view of the TabBar is shown, the view itself does not extend under the TabBar; after the use taps one of the options, all related views extends and change sizes, which makes positioning stuff pretty hard.
I know I could disable the "Extend edges under top bars" and "Extend edges under bottom bars" but that would mess with the view background. The real option is to find a way to force the view (or the TabBar) to extend under top bars and bottom bars always, including the starting view.
There is a repository with the code to duplicate this problem in https://bitbucket.org/juliobiason/tabbarmisbehaviour and an example of what is going on can be see here: https://i.sstatic.net/Jioco.jpg
Upvotes: 0
Views: 582
Reputation: 1337
Ok, I've invested almost an hour in your issue, and I've finally came up with a solution but I don't think it's the best one. The problem you are experiencing is an iOS7 bug, where the bottom layout guide is improperly placed when switching from a view controller to another. So in order to fix this, create a UITabBarController class, implement UITabBarControllerDelegate, set it in the storyBoard and write the following:
@implementation TabBarController
- (void)viewDidLoad {
[super viewDidLoad];
self.delegate = self;
}
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
[tabBarController.view setNeedsLayout];
}
@end
Upvotes: 2