我已经尝试了所有关闭 UIImagePickerController 的变体,但没有任何运气。我究竟做错了什么。
- (IBAction)choosePhoto
{
self.picker = [[UIImagePickerController alloc] init];
self.picker.delegate = self;
self.picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:self.picker animated:YES];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)imagePicker
{
NSLog(@"dismiss image picker");
[self dismissModalViewControllerAnimated:NO];
[[self.picker parentViewController] dismissModalViewControllerAnimated:NO];
[self.presentedViewController dismissModalViewControllerAnimated:NO];
[self.presentingViewController dismissModalViewControllerAnimated:NO];
// And every other way i could think of
}
- (void)imagePickerController:(UIImagePickerController *)imagePicker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
.. same stuff here
}
我试图从父母、祖父母、navigationController 和根控制器中展示选择器,但没有任何效果。无论我做什么,我都不能解雇 ImagePickerController。
请注意,每次都会调用日志语句。
干杯