【发布时间】: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.
}];
有人有什么想法吗?
【问题讨论】:
-
我敢打赌,
navigationItem是nil。 -
其实
navigationItem不是nil,而是leftBarButtonItem可以设置,但显然不是正确的viewcontroller。
标签: ios ios7 uiimagepickercontroller