1

我有一個uiviewcontroller旋轉的問題。UIViewcontroller不會旋轉

我有一個帶註解的mapkit視圖,當點擊時顯示一個popover。 (一切正常到這一點)

在該彈出框中有一個附加到segue(模態)的按鈕,該按鈕將轉換爲彈出窗口的fullsize視圖。 mapkit視圖與彈出窗口一起旋轉,但全尺寸視圖(當存在時)不旋轉。 我可以看到iPad工具欄旋轉,但全尺寸視圖不會。

酥料餅帶有

- (void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view { 


//display basic popover on map 
if([view.annotation isKindOfClass:[MapAnnotation class]]){ 

    storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; 
    viewController = [storyboard instantiateViewControllerWithIdentifier:@"MapPopover"]; 


    popOverController = [[UIPopoverController alloc] initWithContentViewController:viewController]; 

    [popOverController presentPopoverFromRect:view.bounds inView:view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 

    //de-select annotation so the map will detect if you tap it again 
    [map deselectAnnotation:view.annotation animated:NO]; 
} 

下面是該問題的示例項目。 https://github.com/nhart/UIViewController-Problem


回答

0

你必須覆蓋

  • (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

在你的模態的viewController和要旋轉到所有方向返回YES。