开发者

Identifying what UIControlEvents was triggered by UIButton (or other widget)

开发者_JAVA百科I have defined the following method:

- (IBAction)actionPerformed: (id)sender { ... }

and registered it with several widgets (UIButtons mostly) on a view. I'd like to log a message telling me who triggered which UIControlEvents, e.g.

NSLog( @"The following: %@ was triggered by %@\n", <control events>, <button identifier> );

I don't want to use title as some of the button might share the same title; is there an equivalent to the id on an HTML element?

And I couldn't find a way to extract the UIControlEvents from the sender/UIButton. Any ideas?


This is what I have been using to find out which button called my 'pressed' function (it's linked to 64 buttons...) I'm not sure about finding out which function did it though... Hope this helps!

-(IBAction) pressed:(id)sender {
UIButton *button = (UIButton *)sender;
{NSLog (@"blah blah blah %@, sender) etc }

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜