我的问题是:如何获取 locationManager 坐标到我的 viewDidLoad 方法,以使用我之前检查的位置加载我的地图视图???
我的 locationManager 看起来像这样(UIlabel 的字符串):
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
if (wasFound) return;
wasFound = YES;
CLLocationCoordinate2D loc = [newLocation coordinate];
latitude.text = [NSString stringWithFormat: @"%f", loc.latitude];
longitude.text = [NSString stringWithFormat: @"%f", loc.longitude];
}
我的 viewDidLoad 是这样的:
CLLocationCoordinate2D theCoordinate1;
theCoordinate1.latitude = 37.786996;
theCoordinate1.longitude = -122.419281;
所以我想将我的真实坐标插入经纬度的地方!
谢谢!