WatchKit:WKInterfaceMap 中的 setVisibleMapRect 与 setRegion
WatchKit: setVisibleMapRect vs. setRegion in WKInterfaceMap
WKInterfaceMap
defines two methods to set the visible part of the map: setVisibleMapRect
and setRegion
。两者都有非常相似的描述,行为方式(据我所知)相同。
这两种方法有什么区别?
更令人困惑的是,WatchKit Catalog 示例应用在其中一种方法中同时使用了它们:
...
[self.map setVisibleMapRect:MKMapRectMake(newCenterPoint.x, newCenterPoint.y, self.currentSpan.latitudeDelta, self.currentSpan.longitudeDelta)];
[self.map setRegion:region];
...
根据 Apple 的开发者库:
mapRect
The region to be displayed, specified as a map rectangle. The size of
the rectangle provides an implicit zoom value for the map. For more
information about the MKMapRect type, see MapKit Data Types Reference.
坐标区域
The new region of the map to be displayed. The span value of this
parameter provides an implicit zoom value for the map. For more
information about the MKCoordinateRegion type, see MapKit Data Types
Reference.
所以,两者的结果是一样的,只是改变了指定的方式。
WKInterfaceMap
defines two methods to set the visible part of the map: setVisibleMapRect
and setRegion
。两者都有非常相似的描述,行为方式(据我所知)相同。
这两种方法有什么区别?
更令人困惑的是,WatchKit Catalog 示例应用在其中一种方法中同时使用了它们:
...
[self.map setVisibleMapRect:MKMapRectMake(newCenterPoint.x, newCenterPoint.y, self.currentSpan.latitudeDelta, self.currentSpan.longitudeDelta)];
[self.map setRegion:region];
...
根据 Apple 的开发者库:
mapRect
The region to be displayed, specified as a map rectangle. The size of the rectangle provides an implicit zoom value for the map. For more information about the MKMapRect type, see MapKit Data Types Reference.
坐标区域
The new region of the map to be displayed. The span value of this parameter provides an implicit zoom value for the map. For more information about the MKCoordinateRegion type, see MapKit Data Types Reference.
所以,两者的结果是一样的,只是改变了指定的方式。