我能够获得用户当前位置的经度和高度,但不能获取位置名称。我使用了userLocation属性,如下所示:
NSLog(@"Current location=%@",mapView.userLocation);
但是,它给了我输出
Current location=<MKUserLocation: 0x1f59e8c0>
我想获取该位置的字符串值而不是0x1f59e8c0。怎么做?
答案 0 :(得分:1)
NSLog(@"Current location %@",mapView.userLocation.title);
P.S。还有更多属性字幕
答案 1 :(得分:1)
从MKMapView文档开始:http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MKMapView_Class/MKMapView/MKMapView.html
您可以按照链向下查找经度是CLLocationCoordinate2D的一部分(并且是双重的) http://developer.apple.com/library/ios/#documentation/CoreLocation/Reference/CoreLocationDataTypesRef/Reference/reference.html#//apple_ref/doc/c_ref/CLLocationCoordinate2D
NSLog(@"Current longitude = %f",mapView.userLocation.location.coordinate.longitude);