【问题标题】:UINavigationBar system type buttons are disabledUINavigationBar 系统类型按钮被禁用
【发布时间】:2012-01-29 09:50:34
【问题描述】:

我使用 UINavigationController 作为我的视图控制器。在 init() 或 viewDidLoad() 中,我设置了:

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] 
   initWithBarButtonSystemItem:UIBarButtonSystemItemEdit 
   target:self action:@selector(selector)];

在显示或推送视图时,右侧栏按钮(如果有,则左侧)被禁用。但是如果我用自定义按钮替换,那么它可以正常工作。

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] 
   initWithImage:image title:nil 
   target:self action:@selector(selector)];

我认为这是我的另一个问题的根本原因:
MFMailComposeViewController navigation bar buttons are disabled

有人有想法吗? 提前致谢!

【问题讨论】:

    标签: objective-c uinavigationcontroller uibarbuttonitem


    【解决方案1】:

    启用编辑按钮项的正确方法是:

    self.navigationItem.rightBarButtonItem = self.editButtonItem;
    

    其他UIBarButtonItemSystemItems 也会出现这种情况吗?

    【讨论】:

    • 是的!每个 UIBarButtonItemSystemItem 类型的按钮都会出现这种情况。
    • self.editButtonItem 是解决方案之一(使用自定义按钮可以解决),但在 MFMailComposeViewController 的情况下仍未使用。
    猜你喜欢
    • 1970-01-01
    • 2014-04-21
    • 1970-01-01
    • 1970-01-01
    • 2016-02-22
    • 1970-01-01
    • 1970-01-01
    • 2015-06-21
    • 2017-05-08
    相关资源
    最近更新 更多