开发者

How do I identify which button was pressed?

开发者 https://www.devze.com 2023-02-10 10:40 出处:网络
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

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.

0

精彩评论

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

关注公众号