我有一个应用程序需要检测用户位置并在 MKMapView
上放置一些 MKAnnotations
。如何获取有关用户是否在位置服务提示上选择"is"的通知,以便调用我的方法来获取用户位置并添加注释?
最佳答案
这将在位置管理器委托(delegate) didUpdateToLocation 中发生;
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
MyAnnotation * annotation = [[MyAnnotation alloc] initWithCoordinate:coordinate];
[self.mapView addAnnotation:annotation];
}
您将需要创建一个 MyAnnotation 类。看看这里:https://stackoverflow.com/a/2878806/1535038
关于ios - CLLocationManager - 在位置服务提示后加载 MKAnnotation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11851067/