开发者

How does the Maps app on the iPhone 3Gs rotate as you turn the phone?

On an iPhone 3Gs, if you click the little "show my location" symbol on the lower left of the window twice, it switches to a mode that causes the map to rotate so that north on the map faces towards north according to the compass. I don't have a 3Gs, so I just found out about this from a buddy who does have one开发者_JAVA百科.

I tried applying a rotation transformation to a MKMapView's layer, like this:

CATransform3D rotationTransform = CATransform3DIdentity;  
rotationTransform = CATransform3DRotate(rotationTransform, degreesToRadians(-20), 0.0, 0.0, 1.0);  
theMapView.layer.transform = rotationTransform;

That sort of works, but not really. The contents of the map do rotate, but the frame rotates and stretches. The map view ends up in a strip that stretches diagonally across the screen, and it ends up under the buttons in my view.

I tried enclosing the map in another view to isolate it, but that doesn't work either. Next I'll try rotating the enclosing view, but I'm hoping somebody else has figured this out. Getting it to work by trial and error is likely to be difficult at best.

Regards,

Duncan C


I have the same problem. I was able to solve the stretching by placing the MkMapView in a UIView container.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜