1
我有一個UIImagePickerController作爲模式在iOS 7的UIPopoverController中呈現。當它出現時,我看不到任何取消按鈕。我試圖在其導航欄中插入leftBarItem:iOS 7設置UIImagePickerController 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'。 – Kevin
它是。但爲什麼? – randomor
其實'navigationItem'不是零,但'leftBarButtonItem'可以設置,但顯然不是正確的viewcontroller。 – randomor