2013-12-18 81 views
0

我想完成一個非常簡單的任務。有一個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

有沒有人有過同樣的問題?

+0

我只是用你的代碼,它工作得很好。 –

+0

@Shabirjan嗨,你用哪個ios? – PaperThick

+0

我正在使用ios 7 –

回答

0

只要刪除行「picker.allowsEditing = NO;」 &從設備&來看,它刪除的應用..

可能是它

+0

對不起,並非如此 – PaperThick

相關問題