0

我使用下面的代碼行來獲取PhotoLibrary及其完美的工作,並且視圖可以通過取消按鈕出現在右上側來解除:取消按鈕出現在iOS 5上禁用在iOS 4上使用presentViewController

[self presentModalViewController:imgPicker animated:YES]; 

但是,在iOS 5下面的代碼行是獲取PhotoLibrary,但「取消按鈕」是禁用的,即該視圖不能被取消按鈕取消。

[self presentViewController:imgPicker animated:YES completion:nil]; 

回答

0

您沒有傳遞視圖控制器,而是視圖控制器類。嘗試使用舊的imgPicker而不是UIImagePickerController

另外,在目標C中沒有這樣的東西,它應該是nil

+0

imgPicker是UIImagePickerController它與iOS 4,任何其他建議工作正常嗎? – Kazmi 2012-01-30 10:04:29

+0

是的。將'UIImagePickerController'替換爲實例化的'imgPicker'。 – Mundi 2012-01-30 13:25:37

1
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];    
[imagePicker setDelegate:self];     
[self presentModalViewController:imagePicker animated:TRUE]; 

這對我而言也適用於iOS 5。

相關問題