不能禁止编辑UIImagePickerController

时间:2013-12-18 10:20:36

标签: ios iphone objective-c ios7

我正在尝试完成一项非常简单的任务。有一个viewController,用户可以选择从相机中选择图像。我已经从AppCodas教程here.

中完成了一个复制粘贴

问题在于我不希望我的用户能够编辑照片,因为出于某种原因,在横向模式下,照片会以奇怪的方式被剪切,而我不想要方形照片。所以我正在做的是:

- (IBAction)takePhotoClicked:(id)sender {

    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = NO;
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;

    [self presentViewController:picker animated:YES completion:NULL];
}

- (IBAction)selectPhotoClicked:(id)sender {

    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = NO;
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

    [self presentViewController:picker animated:YES completion:NULL];
}

非常简单地根据用户选择显示UIImagePickerController,但它不适用于picker.allowsEditing = NO;因为我第二次打开imagePicker时收到错误消息:Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.我从nil返回didFinishPickingMediaWithInfo

有没有人遇到过同样的问题?

1 个答案:

答案 0 :(得分:0)

只需删除“picker.allowsEditing = NO;”行&安培;从设备&中删除应用程序跑吧..

可能是它