【问题标题】:iOS 7 set UIImagePickerController leftBarItemiOS 7 设置 UIImagePickerController leftBarItem
【发布时间】:2013-10-09 22:20:49
【问题描述】:

我有一个 UIImagePickerController 在 iOS 7 的 UIPopoverController 中显示为模式。当它出现时,我看不到任何取消按钮。我试图在它的导航栏中插入一个 leftBarItem:

picker.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(dismissModalViewControllerAnimated:)];

但它不起作用。

这是我展示选择器的方式:

if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
    [picker.navigationBar setTranslucent:NO];
    [picker.navigationBar setBarStyle:UIBarStyleBlackOpaque];
    [picker.navigationBar setBarTintColor:barGray];        
}else{
    [picker.navigationController.navigationBar setTintColor:barGray];
}
[self presentViewController:picker animated:YES completion:^{
    //I also tried to put the leftBarItem setting code here. Doesn't work either.
}];

有人有什么想法吗?

【问题讨论】:

  • 我敢打赌,navigationItemnil
  • 其实navigationItem不是nil,而是leftBarButtonItem可以设置,但显然不是正确的viewcontroller。

标签: ios ios7 uiimagepickercontroller


【解决方案1】:

我可以使用 UINavigationController 委托方法设置leftBarButtonItem。原来picker.navigationItem 不会削减它,因为它不会是它自己的导航控制器中的根视图控制器

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-27
    • 2014-01-20
    • 1970-01-01
    相关资源
    最近更新 更多