Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个始终位于地图中心的 MKPinAnnotationView。平移和缩放时,图钉会给我地图的中心坐标(纬度/经度)。
目前,当您放大时,它只会放大到您指示地图放大的任何位置。
我真的很想将变焦锁定在图钉上。
关于我如何实现这一目标的任何想法?
假设 MKPinAnnotation 你的意思是 MKPinAnnotationView,你可以访问注释的坐标并使用它来创建一个区域,然后将 mapView 的区域设置为以坐标为中心的区域:
MKCoordinateRegion region = MKCoordinateRegionMake(pin.annotation.coordinate, MKCoordinateSpanMake(.05, .05)); [self.mapView setRegion:region animated:YES];