【问题标题】:PopOver frame issue in iPhone SDKiPhone SDK 中的 PopOver 框架问题
【发布时间】:2013-01-17 13:28:36
【问题描述】:

我在地图视图中显示如下弹出框:

但是当我旋转设备时,它显示为:

如您所见,它覆盖了注释,而不是仅显示在注释旁边。

我的代码如下图:

CGPoint annotationPoint = [mapView convertCoordinate:aView.annotation.coordinate toPointToView:mapView];
        float boxDY=annotationPoint.y;
        float boxDX=annotationPoint.x;
        CGRect box = CGRectMake(boxDX,boxDY,5,5);


        UILabel *displayLabel = [[UILabel alloc] initWithFrame:box];


         [popView presentPopoverFromRect:displayLabel.frame inView:mapView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];


        [displayLabel release];

帮我解决这个问题。

【问题讨论】:

    标签: ios xcode ipad mkmapview uipopovercontroller


    【解决方案1】:

    您可以尝试重写以下方法(在 UIViewcontroller.h 中声明):

    - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration;
    

    您可能需要保存 viewController 的状态(如 isPopoverPresented、哪个注解等)并相应地更新弹出框的矩形。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-04
      • 1970-01-01
      • 2011-05-04
      • 2011-05-14
      相关资源
      最近更新 更多