iOS - 시스템 자체 지도 내비게이션 조정

1286 단어
CLGeocoder *geocoder = [[CLGeocoder alloc]init];

 [geocoder geocodeAddressString:self->model.address completionHandler:^(NSArray *placemarks, NSError *error) {
        // 
        CLPlacemark *clPlacemark1=[placemarks firstObject];// 
        //
//        MKPlacemark *mkPlacemark1=[[MKPlacemark alloc]initWithPlacemark:clPlacemark1]; // , , 
        [geocoder geocodeAddressString:self->model.address completionHandler:^(NSArray *placemarks, NSError *error) { CLPlacemark *clPlacemark2=[placemarks firstObject];// 
            
            MKPlacemark *mkPlacemark2=[[MKPlacemark alloc]initWithPlacemark:clPlacemark2];
            // 
            MKMapItem *mapItem1=[MKMapItem mapItemForCurrentLocation];
            // 
            MKMapItem *mapItem2=[[MKMapItem alloc]initWithPlacemark:mkPlacemark2];
            //MKMapItem *mapItem2=[[MKMapItem alloc]initWithPlacemark:mkPlacemark1];
            [MKMapItem openMapsWithItems:@[mapItem1,mapItem2] launchOptions:@{MKLaunchOptionsDirectionsModeKey: MKLaunchOptionsDirectionsModeDriving,
                                                                              MKLaunchOptionsShowsTrafficKey: [NSNumber numberWithBool:YES]}];}]; 
}];

이 방법은 핸드폰 지리적 위치에 따라 시스템을 조정하고 내비게이션을 하는 거예요. 대부분 구글이에요.

좋은 웹페이지 즐겨찾기