Reputation: 3830
I'm having trouble with my UITabBarController
in the sense that my first view of the first UIViewController
is being offset about 20 pixels to the bottom. Whenever I tab around and/or return to the first view controller (same instance, not released), it's fine. It's only the first encounter.
My steps:
UITabBarController
UIViewController
viewControllers
property to an array of the above mentioned 3 itemsMy code:
- (void)viewDidLoad {
[super viewDidLoad];
// Allocate and initialize view controllers
self.debtsViewController = [[DebtsViewController alloc] init];
self.debtsViewController.title = NSLocalizedString(@"Debts", nil);
self.debtsViewController.tabBarController = self;
self.conclusionsViewController = [[ConclusionsViewController alloc] init];
self.conclusionsViewController.title = NSLocalizedString(@"Entries", nil);
self.conclusionsViewController.tabBarController = self;
self.settingsViewController = [[SettingsViewController alloc] init];
self.settingsViewController.title = NSLocalizedString(@"Settings", nil);
// Assign to tabBarController
self.viewControllers = [NSArray arrayWithObjects:self.debtsViewController, self.conclusionsViewController, self.settingsViewController, nil];
}
Any ideas?
Screenshot: http://cl.ly/image/2E0S001d0Q2x (notice the black space just above the UITableViewController
)
Upvotes: 1
Views: 283
Reputation: 5977
i solved this problem.
```
[tab setSelectedIndex:1];
[tab setSelectedIndex:0];
```
you can manually reset the offset by switch the tab bar after the tabbarcontroller initialized
Upvotes: 1
Reputation: 4092
Having a glance at your screenshot made me think, that actually you should have 3 UINavigationControllers
inside the UITabBarViewController
. Their navigationBars will be(almost) lookalike, but it will be 3 separate instances. What does 'Settings' have in common with 'Debts'? Why would they share same navigation?
The point of using UITabBarViewController
is to have independent sections of the app. I strongly recommend you Apple's guide.
Upvotes: 0