Sean McMains
Sean McMains

Reputation: 59193

Adding Info Button to UITabBarController's More Screen

I'm trying to add an Info button to the More screen that UITabBarController generates when you have more than 5 tabs. The code I'm using is this:

// Add the info button to the more controller
UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
UIBarButtonItem *infoBarButton = [[[UIBarButtonItem alloc] initWithCustomView:infoButton] autorelease];
tabBarController.moreNavigationController.navigationItem.leftBarButtonItem = infoBarButton;

This sort of thing seems to work fine with other UIViewControllers, but in this case, the code builds and runs fine, but the button never appears.

Any idea what might need changing to get this to work?

Upvotes: 1

Views: 1080

Answers (1)

Sean McMains
Sean McMains

Reputation: 59193

Aha! I needed to access the first item in the moreNavigationController stack, rather than the moreNavigationController itself.

tabBarController.moreNavigationController.topViewController.navigationItem.leftBarButtonItem = infoBarButton;

Upvotes: 5

Related Questions