我的問題是:我如何獲得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;
所以我想插入我的真實座標經緯度的地方!
謝謝!