自动旋转时 UIPopOverController 问题 [英] UIPopOverController issues while autorotation
本文介绍了自动旋转时 UIPopOverController 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 PresentPopOverFromRect: 方法展示一个 UIPopovercontroller.在纵向方向.当我自动旋转到横向时,UIPopoverController 没有出现在正确的位置.自动旋转设备时如何定位 UIPopoverController.
I am presenting a UIPopovercontroller using PresentPopOverFromRect: method. in Portrait Orientation. When i autorotate to Landscape UIPopoverController is not presenting at the proper position. How to position the UIPopoverController while autorotating the device.
推荐答案
是的,正如 tiguero 所说,在您的自定义UIViewController,你可以重写方法:
Yes, as tiguero says, in your custom UIViewController, you can override the method:
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
[self.popOverViewController dismissPopoverAnimated:NO];
CGRect yourNewRect = CGRectMake(0.0, 0.0, 20, 20);
[self.popOverViewController presentPopoverFromRect:yourNewRect inView:yourView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
你可以试试!
这篇关于自动旋转时 UIPopOverController 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文