I drag 2 IBActions from a UIButton
, one with touchDown event and second with drag Inside.
- (IBAction)clickButton:(UIButton *)sender {
NSLog(@"Click Button");
}
- (IBAction)dragInsideButton:(UIButton *)sender {
NSLog(@"Drag Button");
}
But when I drag inside, the touchDown action also gets fired.
How to disable touchDown event when dragInside.
Thanks!
I got from Two action methods for an UIButton; next track and seek forward:
Change it As per your requirement.
Personally I'd just track the button's state with an integer on your view controller or within a button subclass. If you track what the button is doing you can control what each of the actions do. In your .h file put in some stuff like this:
And then in your .m file throw in some of this stuff:
After that just link the button's actions to what I've noted in the comments before the IBactions. I haven't tested this but it should work.
i have solved a problem like this with using drag Events
add events to your button in .xib file or programatically.
programmatically is:
then defininitons of events are:
i'm not sure it will work but you can try
This method is tested, and should do what I think you're trying to do. You can change the delay in the timer to get the effect you want. I had to connect 3 actions to the button to make this work -- the third action is a touchUp that resets the system to the starting condition.
Try this way:
isClicked
is property of type BOOL. Set toYES
.On top of this you can also implement
removeTarget:Action:
Which ever method gets called first set isClick=NO, I expect clickButton is called first in button action.