![](/img/trans.png)
[英]iOS - How to customize the crop rect in UIImagePickerController with allowsEditing on?
[英]UIImagePickerController with allowsEditing doesn't allow panning to crop
我在這里看到了這個問題: UIImagePicker允許編輯卡在中心
似乎有人之前有這個問題,但沒有明確的解決方案。
復制步驟:
我在iOS 7.0.3上。
這是我的代碼:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePicker.allowsEditing = YES;
[self presentViewController:imagePicker animated:YES completion:nil];
你只需要寫下單行代碼。
UIImage *image = [info valueForKey:UIImagePickerControllerEditedImage];
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES; // YES
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:picker animated:YES completion:NULL];
試試這個我認為你缺少sourceType上的UIImagePickerControllerSourceTypeCamera。 看看它是否有效。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.