UIPopOverController中的UIImagePickerController没有在iOS 5中打开 [英] UIImagePickerController in UIPopOverController is not opening up in iOS 5

查看:79
本文介绍了UIPopOverController中的UIImagePickerController没有在iOS 5中打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的iPad应用程序中,我在弹出控制器中打开照片库。它在iOS 4中运行良好,但现在它在iOS 5中无法打开。
i我使用以下代码打开照片库,

in my iPad app i am opening Photo Library in a popover controller. It was working fine in iOS 4 but now its not opening up in iOS 5. i am using the following code for opening Photo Library,

UIImagePickerController* picker = [[UIImagePickerController alloc] init]; 
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    picker.delegate = self;
    picker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypePhotoLibrary];

    popOver = [[UIPopoverController alloc] initWithContentViewController:picker]; 
    popOver.delegate = self;

    int w = 320;

    CGRect pickerFrame = CGRectMake(0, 0, w, bImportPicker.frame.origin.y);
    [popOver setPopoverContentSize:pickerFrame.size animated:NO];   
    [popOver presentPopoverFromRect:pickerFrame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];
    [picker release];


推荐答案

当我的可怜客户搬到iOS 5时,他们的UIPopoverController被从屏幕边缘拉出来。这是因为iOS 5在解释presentPopoverFromRect的第一个参数时与iOS 4不同。当我确保提供的rect为显示器的rect和边缘之间的UIImagePickerController留出足够的空间时,问题就解决了。使用rect的整个显示将产生这种不正常行为,类似于你所描述的行为。

When my poor customers moved to iOS 5, their UIPopoverController was being drawn off the edge of the screen. This is because iOS 5 differs from iOS 4 in its interpretation of presentPopoverFromRect's first parameter. When I made sure the supplied rect leaves enough room for your UIImagePickerController between the rect and the edge of the display, the problem was resolved. Using the entire display for the rect will produce this misbehavior, which resembles what you've described.

这篇关于UIPopOverController中的UIImagePickerController没有在iOS 5中打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆