UIControl = what was the event again?
UIControl = what was the event again?
- Subject: UIControl = what was the event again?
- From: Roland King <email@hidden>
- Date: Wed, 14 Oct 2009 22:59:46 +0800
I must be missing something obvious here but ...
UIControl has a method
- (void)addTarget:(id)target action:(SEL)action forControlEvents:
(UIControlEvents)controlEvents
which lets you add an action to be called when any of the given
controlEvents occur. ControlEvents are a bitmask of events which tell
you if a touch went down, or up inside, or was dragged etc., there's
about 16 of them, you or them together and get called when any of them
occur.
The selector can have one of the following signatures
- (void)action
- (void)action:(id)sender
- (void)action:(id)sender forEvent:(UIEvent *)
none of those tell you what the control event bitmask was. The UIEvent
is something slightly different, it's related to the actual touch
event and doesn't (I think) contain the UIControlEvent. The sender
(UIControl) doesn't have a way to find the control events either.
I'd like to have one method which deals with a number of control
events as I have some common code regardless of which event or events
happened but I still need to know what the UIControlEvents were for
some specific processing.
Am I missing a way to find out what UIControlEvents were used when the
action was called or do I really have to separate my code into
-(void)actionWithUIControlEventX;
-(void)actionWithUIControlEventY;
etc
potentially just calling one private method with an extra argument.
Roland
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden