我有UIImagePickerController打开一个摄像头,如下面的示例代码所示。
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.allowsEditing = YES;
imagePicker.delegate = self;
imagePicker.modalPresentationStyle = UIModalPresentationPageSheet;
[self presentViewController:imagePicker
animated:YES
completion:NULL];
我的问题:当我出示相机时,相机显示,但我无法拍照或点按取消。即使是翻盖相机图标也没有响应。 发生在iOS 8以下版本的iPad上。
答案 0 :(得分:0)
我尝试了你的代码,并在iPad 2上运行iOs7.1.2 你可能会尝试使用setter,这就是我在做的事情
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
[picker setAllowsEditing:YES];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
[picker setSourceType:UIImagePickerControllerSourceTypeCamera];
[picker setModalPresentationStyle:UIModalPresentationPageSheet];
}
else
[picker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[picker setDelegate:self];
[self presentViewController:picker animated:YES completion:nil];