I want to have a button that triggers its method under the following conditions:
You need to add the following UIControlEvents to your button:
UIControlEventTouchUpInside
UIControlEventTouchDragOutside
UIControlEventTouchDragInside
as such
[self.myButton addTarget:self action:@selector(dragMoving:withEvent: )
forControlEvents: UIControlEventTouchDragInside | UIControlEventTouchDragOutside];
[self.myButton addTarget:self action:@selector(dragEnded:withEvent: )
forControlEvents: UIControlEventTouchUpInside |
UIControlEventTouchUpOutside];
[self.myButton addTarget:self action:@selector(myButtonTouchDown:withEvent: )
forControlEvents: UIControlEventTouchDown];