I have many UIButton elements on my MKMapView开发者_如何转开发. When the user clicks on a button I get a showDetails notification. But how do I tell which button the user clicked on? The only hack I know of is to pass in the tag value which is an integer. Surely there must be a more elegant way. I tried subclassing UIButton but since it is a cluster, I cannot subclass it and use all of theUIButtons existing functionality.
Thanks Deshawn
tag is a good way to identify you can also use current title to differentiate if all buttons have different titles. here is a code snippet
[[button currentTitle] isEqualToString:@"your desired string"];
But I prefer use tags.
精彩评论