2013-02-02 89 views
0

我顯示在地圖視圖中的酥料餅如下:酥料餅框架問題

enter image description here

但是,當我旋轉設備,它顯示喜歡:

enter image description here

如您會看到它覆蓋了註釋,而不是顯示在註釋旁邊。

我的代碼如下所示:

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]; 

幫我解決這個問題。

回答

0

你可以試着重寫以下方法(在UIViewcontroller.h聲明):

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

您可能會需要保存的viewController(如isPopoverPresented,其中標註的狀態等)並相應地更新popover的矩形。