我的 TableViewController
上有一个导航栏,上面有两个按钮——“退出”和“+”。我需要放置第三个按钮,让用户能够更改帐户密码。什么地方放最好?在这种情况下,最佳做法是什么?
提前致谢。
最佳答案
您可以使用以下方法在 UINavigationItem
上设置多个条形按钮项目:
- (void)setLeftBarButtonItems:(NSArray *)items animated:(BOOL)animated NS_AVAILABLE_IOS(5_0);
- (void)setRightBarButtonItems:(NSArray *)items animated:(BOOL)animated NS_AVAILABLE_IOS(5_0);
所以你在 UIViewController
中有两个 UIBarbuttonItems
[self.navigationController.navigationItem setRightBarButtonItems:@[button1, button2]];
如果您使用的是 Storyboard,那么您只能在左侧或右侧设置一个按钮(我不知道为什么,这很愚蠢),尽管您可以在标题中设置一个常规的 UIButton
。
关于ios - 导航栏上的另一个按钮在哪里,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27236141/