ios7 – MKMapView禁用旋转

我有一个使用MKMapView作为主要显示区域的应用程序.这应始终朝北向上.但是快速无意的滑动并且它会旋转,导致指南针出现.

有没有办法阻止这种情况发生并保持视图锁定在北方?我在这里看到了一些提示,但没有任何内容涉及任何类型的内置机制.

解决方法

快速浏览Apple关于MKMapView的文档:

rotateEnabled A Boolean value indicating whether the map camera’s
heading information is used.

@property(nonatomic,getter=isRotateEnabled) BOOL rotateEnabled
Discussion When this property is set to YES and a valid camera is
associated with the map,the camera’s heading angle is used to rotate
the plane of the map around its center point. When this property is
set to NO,the camera’s heading angle is ignored and the map is always
oriented so that true north is situated at the top of the map view.

因此,您可以尝试将mapview rotateEnabled属性设置为’NO’.

Apple MKMapView reference

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...