开发者

Log UIControl events

Is there a way of logging the UIControl events that are going on when you touch the screen on the iPhone?

Here's an example - I need to show some information when the user touches down on a button but then lifts their finger outside. However this bit of code doesn't seem to w开发者_如何学Pythonork:

    [self.button addTarget:self action:@selector(showInfo) forControlEvents:UIControlEventTouchDown & UIControlEventTouchUpOutside];


 [self.button addTarget:self action:@selector(showInfo) forControlEvents:UIControlEventTouchDown];
 [self.button addTarget:self action:@selector(showInfo) forControlEvents: UIControlEventTouchUpOutside];

Do it like this.

On topic:

You could inherit the UIButton class and override the following methods:

Responding to Touch Events

– touchesBegan:withEvent:

– touchesMoved:withEvent:

– touchesEnded:withEvent:

– touchesCancelled:withEvent:


Try this

[button addTarget:self action:@selector(showInfo:withEvent:) forControlEvents:UIControlEventTouchDragOutside|UIControlEventTouchUpOutside|UIControlEventTouchDragInside|UIControlEventTouchDown];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜