我想完成一個非常簡單的任務。有一個viewController,用戶可以選擇從相機中選擇圖像。我已經做了幾乎從AppCodas教程here.不能禁止編輯UIImagePickerController
複製粘貼問題是,我不希望我的用戶能夠編輯照片,因爲由於某種原因,照片在景觀中時被奇怪的方式剪輯模式,我不想要一張方形圖片。所以我在做什麼是這樣的:
- (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;
,因爲我得到的錯誤消息不起作用: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.
當我打開imagePicker第二次我從didFinishPickingMediaWithInfo
回到nil
。
有沒有人有過同樣的問題?
我只是用你的代碼,它工作得很好。 –
@Shabirjan嗨,你用哪個ios? – PaperThick
我正在使用ios 7 –