由於某種原因,第一次在我的應用程序中以相機模式打開UIImagePickerController
時,它出現空白。我必須關閉並重新打開該視圖才能使相機饋送開始工作。我正在使用適用於iOS 6的標準代碼來拍攝相機。從下面的示例中我發射了capturePhoto:
方法。任何其他人都會用iOS 7相機跑進這種輕鬆的世界?我檢查了蘋果開發論壇,但幾乎不可能在那裏找到答案。iOS 7 UIImagePickerController相機沒有圖像
- (IBAction)capturePhoto:(id)sender {
[self doImagePickerForType:UIImagePickerControllerSourceTypeCamera];
}
- (void)doImagePickerForType:(UIImagePickerControllerSourceType)type {
if (!_imagePicker) {
_imagePicker = [[UIImagePickerController alloc] init];
_imagePicker.mediaTypes = @[(NSString*)kUTTypeImage];
_imagePicker.delegate = self;
}
_imagePicker.sourceType = type;
[self presentViewController:_imagePicker animated:YES completion:nil];
}
如何在iOS 6中做到這一點? – jianpx
我在捕獲圖像時也遇到了問題。我該如何解決它。 – Nirav
在哪裏使用這個解決方案? – Nirav