将信息按钮添加到 UITabBarController 的更多屏幕
我正在尝试将一个信息按钮添加到 UITabBarController 当您有超过 5 个选项卡时生成的“更多”屏幕。我使用的代码是这样的:
// 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;
这种事情似乎与其他 UIViewController 一起工作得很好,但在这种情况下,代码构建并运行良好,但按钮永远不会出现。
知道需要改变什么才能让它发挥作用吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
啊哈!我需要访问 moreNavigationController 堆栈中的第一项,而不是 moreNavigationController 本身。
Aha! I needed to access the first item in the moreNavigationController stack, rather than the moreNavigationController itself.