1
所以我用这个电话:MKMapView告诉地图使用填充显示MKAnnotations?
mapView.showAnnotations(annotations, animated: true)
动画该应用显示注释。这很好。我需要在此基础之上,是告诉地图填充100个像素添加到其正常放大区域的左侧,当我打电话:
mapView.showAnnotations(annotations, animated: true)
我有一个观点在地图上屏幕的左侧,我不希望注释出现在下面,所以,我想添加填充到它们的左侧,以便它们不被视图隐藏。
我试过的MKMapView称之为 “setRegion” 和:
mapView.setVisibleMapRect(mapRect, edgePadding: UIEdgeInsetsMake(20, 100, 20, 20), animated: true)
,但它不是真正特别的工作时,我尝试了结合:
mapView.showAnnotations(annotations, animated: true)
和:
mapView.setVisibleMapRect(mapRect, edgePadding: UIEdgeInsetsMake(20, 100, 20, 20), animated: true)
实现此目标的正确方法是什么?
你需要填充总是或只有当你显示你的注释? –
可能重复[iOS-MKMapView showAnnotations:animated:with padding?](https://stackoverflow.com/questions/21912339/ios-mkmapview-showannotationsanimated-with-padding) – nathan
@ReinierMelian我大部分时间都需要它。为什么? – zumzum