2015-11-05 64 views
0

我有這種方法,當用戶打開他們的相機膠捲。我將允許編輯設置爲YES,但在編輯屏幕上,方形裁剪框僅出現在iPhone上,而不是iPad上。我錯過了什麼?問題與圖像選擇器允許編輯

- (void)useCameraRoll 
{ 
    if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum]) 
    { 
     UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; 
     imagePicker.delegate = self; 
     imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
     imagePicker.mediaTypes = @[(NSString *) kUTTypeImage]; 
     imagePicker.allowsEditing = YES; 
     if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone) 
     { 
      [self presentViewController:imagePicker animated:YES completion:nil]; 
     } 
     else 
     { 
      dispatch_async(dispatch_get_main_queue(), ^{ 

       [self setModalPresentationStyle:UIModalPresentationFormSheet]; 
       [self.navigationController presentViewController:imagePicker animated:YES completion:nil]; 
      }); 
     } 

    } 
} 

和委託方法

- (void)imagePickerController:(UIImagePickerController *)picker 
didFinishPickingMediaWithInfo:(NSDictionary *)info 
{ 
    NSString *mediaType = info[UIImagePickerControllerMediaType]; 

    [self dismissViewControllerAnimated:YES completion:nil]; 

    if ([mediaType isEqualToString:(NSString *)kUTTypeImage]) 
    { 
     theCustomImage = info[UIImagePickerControllerEditedImage]; 
     [self roundedCorners]; 
     [self placeImage:theCustomImage]; 
     customImage = true; 
     UIImageWriteToSavedPhotosAlbum(theCustomImage, self, @selector(image:finishedSavingWithError:contextInfo:), nil); 
    } 
} 
+0

嘗試刪除表單表單。只是一個預感,我無法驗證它是否會起作用。 – ShahiM

+0

沒有幫助。感謝您的期待 – gikygik

回答

0

只需選中this鏈接。我認爲它是因爲iOS 9. 如果它根本不工作,請嘗試使用像this之類的東西。

+0

謝謝,我會給它一個旋轉。 – gikygik