我的问题是:我如何获得locationManager坐标到我的viewDidLoad方法来加载我的mapview与我以前检查的位置?如何从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;
所以我想插入我的真实坐标经纬度的地方!
谢谢!