我有一个UIImagePickerController,我在Ipad中使用它,但是当你选择其中一个图像时,这里没有发生的事情是选择器的代码:
- (IBAction)addPicture:(id)sender {
CGRect rect = CGRectMake(0, 0, 753, 118);
[popOverController presentPopoverFromRect:rect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self dismissViewControllerAnimated:YES completion:nil];
patientPicture = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
UIImageView *pictureView = (UIImageView *)[imageCell viewWithTag:777];
pictureView.image = patientPicture;
[_imgViewAdd reloadInputViews];
}
-(void)viewDidLoad {
pickerController = [[UIImagePickerController alloc] init];
popOverController = [[UIPopoverController alloc] initWithContentViewController:pickerController];
popOverController.delegate = self;
}
当我选择其中一张照片时,imagepicker加载得很好
提前致谢
答案 0 :(得分:1)
呼叫:
[self dismissViewControllerAnimated:YES completion:nil];
最后而不是第一次。
也...
@interface yourViewController ()<UIImagePickerControllerDelegate,UINavigationControllerDelegate>
您没有设置pickerController委托...
pickerController.delegate = self;
因为你有一个弹出窗口使用这个..
[popOverController dismissPopoverAnimated:YES];
答案 1 :(得分:0)
你可以尝试这个(它对我有用):
-(void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSLog(@"didFinishPickingMediaWithInfo CALLED");
[picker dismissViewControllerAnimated:YES completion:^{
testImageView.image = (UIImage*) [info objectForKey:UIImagePickerControllerEditedImage]; //testImageView is a UIImageView
}];