`

如何通过GPS获取我当前所在的城市或街道

 
阅读更多
- (void)startedReverseGeoderWithLatitude:(double)latitude longitude:(double)longitude{
    CLLocationCoordinate2D coordinate2D;
    coordinate2D.longitude = longitude;
    coordinate2D.latitude = latitude;
    MKReverseGeocoder *geoCoder = [[MKReverseGeocoder alloc] initWithCoordinate:coordinate2D];
    geoCoder.delegate = self;
    [geoCoder start];
}#pragma mark -
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
//NSString *subthroung=placemark.subThoroughfare;
NSString *local=placemark.locality;
//NSLog(@"城市名:%@-%@-%@",placemark.locality,local,subthroung);
    if (local) {
        [cityLabel setText:local];
    }
}
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error
{
}


转帖:http://www.cocoachina.com/bbs/read.php?tid=54370

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics