Re: iOS MapKit rotation leaves blank area
Re: iOS MapKit rotation leaves blank area
- Subject: Re: iOS MapKit rotation leaves blank area
- From: Rick Mann <email@hidden>
- Date: Sat, 25 Dec 2010 11:14:52 -0800
On Dec 25, 2010, at 06:29:49, John Joyce wrote:
>
> On Dec 25, 2010, at 5:41 AM, Rick Mann wrote:
>
>> Hi. I have a simple view-based iPad app that contains a MapKit view. If you start the app in portrait orientation, and then rotate to landscape, everything rotates correctly, but there's a strip along the right edge that remains blank. If you then try to pan or zoom the map, it snaps to fill this area.
>>
>> I did some googling but couldn't find anyone describing this behavior, and I'm not sure what I need to do to correct it. Any suggestions?
>>
>> TIA,
>> Rick
>>
>> _______________________________________________
> Does it happen in the Simulator and on a device?
> (hopefully both)
Yep, both sim & device, both iPad and iPhone. Interestingly, on the iPhone, it defaults to a state that's zoomed in enough that when you rotate, the blank strip doesn't occur. But if you first zoom out all the way on iPhone, and then rotate, it happens.
That prompted me to try a few other things. On sim & both devices, if you change to portrait orientation and pan the map fully to the left (so the map content is all the way to the left), and rotate to landscape, you get a band on the right edge. If, in landscape, you pan the map, it will always snap to fill, and then you can't get the blank strip back, unless you then rotate back to portrait, pan the map to the left, and re-rotate to landscape.
> So you should consider some simple NSLog calls around those events (delegate methods might help) and log the view and super view dimensions.
Logging the view and the map view's frames in willRotate/didRotate, I get numbers that always seem wrong to me (this is portrait-to-landscape):
Will rotate, view frame: {{0, 20}, {768, 1004}}
Will rotate, map frame: {{0, 0}, {768, 1004}}
Did rotate, view frame: {{0, 0}, {748, 1024}}
Did rotate, map frame: {{0, 0}, {1024, 748}}
After rotation, the view's frame still has portrait dimensions. I guess there's a rotation transform on it, but then you can see the map's frame does have the right aspect ratio. Now, in the past, I've always distrusted the frames reported this way, because they've never seemed right.
The subsequent landscape-to-portrait:
Will rotate, view frame: {{0, 0}, {748, 1024}}
Will rotate, map frame: {{0, 0}, {1024, 748}}
Did rotate, view frame: {{0, 20}, {768, 1004}}
Did rotate, map frame: {{0, 0}, {768, 1004}}
> You say the right edge... but does that mean if you rotate either left or right into landscape orientation, you see it on the right edge?
Yep, always blank on the right edge, never the left.
Also note, if you launch in landscape mode, it also occurs.
Thanks,
Rick
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden