1
votes

I have a problem with uiviewcontroller rotation.

I have a mapkit view with annotations that when tapped, display a popover. (everything works to this point)

Within that popover there's a button attached to a segue (modal) which transitions to a fullsize view of that popover. The mapkit view rotates fine with the popovers, but the fullsize view (when present), doesn't rotate. I can see the iPad toolbar rotate, but the fullsize view won't.

Popover presented with

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

Here's a sample project with the problem. https://github.com/nhart/UIViewController-Problem


1

1 Answers

0
votes

you have to override

  • (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

in your modal viewController and return YES for all orientation you want to rotate to.