简体   繁体   中英

iOS mapKit refresh direction when the user's current location is updated

I am developing an application that allows the user to show the itinerary from the current location to the destination. The itinerary must be refreshed when the user's current location changes. I am using the LocationManager to detect the current location. When the current location changes, i re-fetch the directions and display a new itinerary that starts from the new current location. Is there a better and cleaner solution to achieve this ? Thanks.

What you are doing is correct way. Use following method of CLLocationManagerDelegate

-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{

}

to get location update and chage the display accordingly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM