如果UIImagePickerControllerSourceTypePhotoLibrary允许NO

时间:2013-04-08 08:53:50

标签: iphone ios cocoa-touch

当我在相机上使用allowsEditing = NO时,它可以正常工作。

使用:

if( [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
  if(imagePicker == nil) imagePicker = [[UIImagePickerController alloc] init];
   imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
   imagePicker.allowsEditing = NO;

  [self presentViewController:imagePicker animated:YES completion:nil];
}

但如果我尝试将它放在照片库上,我仍然可以获得allowEditing YES。

不要工作:

if( [UIImagePickerController UIImagePickerControllerSourceTypePhotoLibrary])
{
  if(imagePicker == nil) imagePicker = [[UIImagePickerController alloc] init];
   imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
   imagePicker.allowsEditing = NO;

  [self presentViewController:imagePicker animated:YES completion:nil];
}

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

picker.allowsEditing = YES;
picker.delegate = self;