CLLocationManager语言 - 在位置服务提示后加载 MKAnnotation



我有一个应用程序需要检测用户的位置,并在MKMapViewMKAnnotations周围下降一些。如何获得有关用户是否已在定位服务提示上选择"是"的通知,以便调用我的方法获取用户位置并添加注释?

这将发生在位置管理器委托 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

最新更新