如何通过GPS获取我当前所在的城市或街道
http://www.cocoachina.com/bbs/read.php?tid=54370&page=1
- - (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
- {
- }