这是我的代码:
-(IBAction)addUserChooseImage:(id)sender{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:picker animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage: (UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
uploadedImage.image = image;
[picker dismissModalViewControllerAnimated:YES];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[picker dismissModalViewControllerAnimated:YES];
}
当试图解雇选择器时它会坚持。我相信原因是图像选择器由位于视图控制器本身上的加载笔尖视图上的按钮激活。
谁能告诉我解雇它的正确方法是什么?我想代表应该仍然提到自己,对吧?
由于
答案 0 :(得分:1)
您无法使用[picker dismissModalViewControllerAnimated:YES];
方法解雇选择器。
将[picker dismissModalViewControllerAnimated:YES];
替换为[self dismissModalViewControllerAnimated:YES];
答案 1 :(得分:1)
在这里你遗漏了一些东西,见下文
你应该使用。
[self dismissModalViewControllerAnimated:YES];
而不是下面。
[picker dismissModalViewControllerAnimated:YES];