开发者

Adding Info Button to UITabBarController's More Screen

I'm trying to add an Info button to the More screen that UI开发者_开发技巧TabBarController 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?


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

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜