[英]UIImagePickercontroller cancel button not display in iPad
I'm getting saved images from photo album while clicking button. 单击按钮时,我正在从相册中保存图像。 After dispalying photo album i don't have cancel button in iPad for cancel the photo album.
取消相册后,我在iPad中没有“取消”按钮以取消相册。 After choosing anyone saved images from photo album then it closing and adding picking image to UIImageView.
选择任何人从相册中保存图像后,它将关闭并将拾取图像添加到UIImageView。 But without choosing image from gallery i'm not able to close the photo album.
但是如果没有从图库中选择图片,我将无法关闭相册。 In iphone it's working with cancel.
在iPhone中,它正在使用cancel。
-(void)picker:(id)sender{
if ([self->popoverController isPopoverVisible]) {
[self->popoverController dismissPopoverAnimated:YES];
} else {
if ([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypeSavedPhotosAlbum])
{
imagePicker=[[UIImagePickerController alloc]init];
imagePicker.delegate = self;
imagePicker.allowsEditing =NO;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
self->popoverController = [[UIPopoverController alloc]
initWithContentViewController:imagePicker];
self->popoverController.delegate = self;
CGRect popoverRect = [self.view convertRect:[self.view frame]
fromView:[self.view superview]];
popoverRect.size.width = MIN(popoverRect.size.width, 100) ;
popoverRect.origin.x = popoverRect.origin.x+10;
[self->popoverController
presentPopoverFromRect:popoverRect
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
}
-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
//release picker
// [picker dismissModalViewControllerAnimated:YES];
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
[picker dismissViewControllerAnimated:YES completion:nil];
}else{
[picker dismissViewControllerAnimated:YES completion:nil];
if (popoverController != nil) {
[popoverController dismissPopoverAnimated:YES];
popoverController=nil;
}
}
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
if (popoverController != nil) {
[popoverController dismissPopoverAnimated:YES];
popoverController=nil;
}
[picker dismissViewControllerAnimated:YES completion:nil];
}
您将在popoverController中显示imagePickerController,因此它将没有“手动取消”按钮,因为您可以点击弹出框之外的任何位置以将其关闭。
I've met this problem before. 我以前遇到过这个问题。 Please check the accepted answer in my question below.
请在下面的问题中检查接受的答案。 It worked for me.
它为我工作。
UIImagePickerController inside UIPopoverController doesn't show Cancel button on iOS7 UIPopoverController中的UIImagePickerController在iOS7上未显示“取消”按钮
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.