Skip to main content
December 14, 2011
Answered

iOS MapKit rotation

  • December 14, 2011
  • 1 reply
  • 1456 views

Ok, so I making an iPad application in AIR that uses some native UIViews via Native Extensions.

I wrote a native extension that adds a functional MapKit on screen.

I also wrote a native extension that opens an SMS-composer-view so users can send SMS'es.

My application is always locked in landscape mode.

When I prompt the SMS-composer... it shows up in landscape mode.

When I prompt native alerts... they show up in landscape mode.

But when I add the MapKit to the screen, it's in portrait mode... I don't set an orientation or rotation anywhere in my ane.

I absolutely have no idea what or where this problem comes from...

Anyone have a clue how I could force the MapKit to landscape mode?

This topic has been closed for replies.
Correct answer

Hi Brandov:

Are you creating a MapView in its own ViewController? Can you try adding the MapView to the root View Controller.. something like following

[[[[[UIApplication sharedApplication] windows] objectAtIndex:0] rootViewController].view addSubview:mapView];

after this your MapView should obey the autoOrients property in App Descriptor.

1 reply

December 14, 2011

Ok so I tried this:

put autorotation ON for my application...

My application rotates as excpected when I rotate the device, except for the mapkit

The MapKit stays in portrait mode, no matter what.

I have flash-UI-elements, a MapKit window and an SMS-composer overlayed over everything all on 1 screen.

When I turn the device everything rotates but the MapKit stays put... *sigh*

Correct answer
December 15, 2011

Hi Brandov:

Are you creating a MapView in its own ViewController? Can you try adding the MapView to the root View Controller.. something like following

[[[[[UIApplication sharedApplication] windows] objectAtIndex:0] rootViewController].view addSubview:mapView];

after this your MapView should obey the autoOrients property in App Descriptor.

December 15, 2011

Awesome it's working now, thanks Bhave (or Saumitra... not entirely sure what you first name is ^_^)

I was using this: [[[UIApplication sharedApplication] keyWindow] addSubview: mapView];

I figured that this was the culprit and had already tried some different ways of adding it to the screen but none of them worked so far.

But that one did the trick. Yay!