开发者

Getting current location and displaying search results automatically within MKMapView

I would like to get the current location of the user in my application with MKMapView and then display the search results automatically when the user opens the map. For example, the user open the application and then they have to allow the application to use their current location开发者_运维百科 and then they open up the maps tab and then they are able to view all the places near them that contains a certain word, for example, "coffee shop". How would one go about doing this?


you can use mapview delegate method

  • (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation

to get the current location of the user. then based on the coordinates of the "coffee shop" you can add annotaton to the maview. current location will be shown with a blue dot and other locations with a default pin, so that u can differentiate current location and other location

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜