How can I make a UIButton enable as a touch when I drag from area outside in xcode?
I am trying to make a UIButton be able to be enabled if I drag my finger from the regi开发者_开发技巧on outside the button. It only works right now if I press the button like normal. I have tried using all of the events, but it doesn't look like it even will respond to any of the drag events. I have searched everywhere, but I cannot find an answer. Thanks!
You should need to use a selector to dragEnter
event for a UIButton
.
[your addTarget:self action:@selector(buttonDragged:)
forControlEvents:UIControlEventTouchDragEnter];
and implement the buttonDragged: method
-(void)buttonDragged:(UIButton*) sender{
//Your logic here
}
精彩评论