How to show a view when a user clicks on pin annotation?
I am developing a project in which I have parse json
data and save it into an array. From that array, I have make a UITableView
in which I have a number of businesses. With the help of their latitude and longitude, I show them on an MKMapView
.
Now I want to add an event that is when I click on a pin annotation, I push a detail view over the pin of associated business. In same manner, when I click on row of UITableView
and open the view relative to that row. So how do I do that with pin annotation of the business point?
For example, we have a list of places in a UITableView
and a button add on navigation-bar which calls an MKMapView
. When I click on the add button, I then display an MKMapView
, and drop pins on map with their respective latitude and longitude.
Now when user clicks on pin number 3, I open the view of details of that pin. Similarly, when user click on row number 3, I open the same view as when he clicked on pin number 3.
How can I set that event in my project?
You should look into the canShowCallout:
method found here. There are also many online tutorials on how to do this. Hope that Helps!
精彩评论