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。