How do I identify which button was pressed?
I have seen the answer to this question.
However, I have a page where I add many custom map annotatio开发者_如何学运维ns to a map, and I need to know which AnnotationView's rightCalloutAccessoryView (a UIButton in my case) was pressed.
The ideal would be to set a custom ID attribute on the button. But seeing as I can't find a mechanism to do that, I guess it's not the way.
UIView
object has a tag
property you can freely set and read. You may find this is useful.
when you declare your button action method like this: yourMethod:(id)sender
you will receive a pointer to the button(or whatever object) which called the action, in the sender var
I think some of these answers might help.
精彩评论