ios7 – MKMapView禁用旋转

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

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

解决方法

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

rotateEnabled A Boolean value indicating whether the map camera’s
heading @R_873_4045@ion 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

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...