我的应用在底部有一个工具栏,其中一个选项为Upload
。点击它后,会出现PopOverController
,显示可供选择的照片列表。
选择照片后,我想显示一个视图(在PopOverController
内部),其中包含照片以及名为Upload
的按钮。在选择我的照片时,目前我的PopOverController
没有被解雇。我使用了以下几行代码:
-(IBAction)photolibrarypressed:(id)sender{
NSLog(@"hi");
UIImagePickerController *picker= [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
picker.delegate = self;
UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker];
self.popoverController = popover;
popoverController.delegate = self;
[popoverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
imageView = [[UIImageView alloc] initWithFrame:[window bounds]];
[window addSubview:imageView];
imageView.hidden = YES;
[window makeKeyAndVisible];
}
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage:(UIImage *)image
editingInfo:(NSDictionary *)editingInfo
{
imageView.image = image;
NSLog(@"hellow");
[self dismissModalViewControllerAnimated:YES];
// need to show the upload image button now
upload.hidden = NO;
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[picker dismissModalViewControllerAnimated:YES];
exit(0);
}
有人可以帮我解决问题吗?
答案 0 :(得分:0)
而不是打电话
[self dismissModalViewControllerAnimated:YES];
调用与cancel方法相同的cancel方法来处理解除它的模态视图
[picker dismissModalViewControllerAnimated:YES]; // Dismisses modalView