私はiPhoneのMapKitに助けが必要です! インタフェースビルダーを使用して簡単なマップビューを作成し、show userの場所をyesに設定しました。 しかし、配備したitouchに「青い点」が表示されません!私はそれに助けが必要です!iphone現在の位置は表示されません
また、どのようにしてユーザーの現在地を取得し、別の場所へのルートをプロットすることができますか? リンゴのマップアプリの使い方のような使い方の公式APIはありませんか?ルートを描く。
ありがとうございました!
マイコード。
のviewDidLoad
- (void)viewDidLoad {
locationManager = [[CLLocationManager alloc] init];
[locationManager setDelegate:self];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
[locationManager startUpdatingLocation];
[super viewDidLoad];
}
locationManager:didUpdateToLocation:fromLocation:点2については
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
[mapView setMapType:MKMapTypeStandard];
mapView.showsUserLocation = YES;
MKCoordinateRegion region;
CLLocationCoordinate2D location;
location.latitude = newLocation.coordinate.latitude;
location.longitude = newLocation.coordinate.longitude;
region.center = location;
region.span.longitudeDelta = 0.02;
region.span.latitudeDelta = 0.02;
[mapView setRegion:region animated:YES];
[mapView setDelegate:self];
}