UIImagePickerController在视图上添加为subView并打开相机2-3次应用程序崩溃。 “快照未渲染的视图会导致空白快照。确保您的视图在屏幕更新后的快照或快照之前至少渲染一次。” “收到内存警告”
UIImagePickerController * imagePickerController = [UIImagePickerController new];
imagePickerController.view.tag=view.tag;
imagePickerController.delegate = self;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
[imagePickerController.view setFrame:CGRectMake(0, 0, SCREEN_WIDTH, KCameraViewHeight)];
[self.view addSubview:imagePickerController.view];"
-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[picker.view removeFromSuperview];
[picker removeFromParentViewController];
}