开发者

Have UIButton showDetails take in an argument

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜