开发者

How can I make a UIButton enable as a touch when I drag from area outside in xcode?

开发者 https://www.devze.com 2023-02-27 04:37 出处:网络
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

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
}
0

精彩评论

暂无评论...
验证码 换一张
取 消