Sunday, 29 September 2013

How to distinguish between fired events for a UIButton callback action

How to distinguish between fired events for a UIButton callback action

When defining a callback for a UIButton I listed several events for the
same action
In the target I would like to be able to distinguish what event triggered
the callback
[button addTarget:self action:@selector(callback:)
forControlEvents:UIControlEventTouchDown | UIControlEventTouchCancel];
-(void)callback:(UIButton *)button
{
// need to be able to distinguish between the events
if (event == canceled)
{
}
if (event == touchDown)
{
}
... etc
}

No comments:

Post a Comment