开发者

Have UIButton showDetails take in an argument

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

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

精彩评论

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