开发者

[xcode-iPhone]two quick touches

Hello, I would like to know how a button that recognizes a touch and two quick touche开发者_运维问答s


Try to add following action to Your Button

UIControlEventTouchDownRepeat

Example

    UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    button.frame = CGRectMake(100.0, 100.0, 80.0, 50.0);
    [button setTitle:@"Tap Me!" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(touchDownRepeat:) forControlEvents:UIControlEventTouchDownRepeat];     
    [self.view addSubview:button];


This might sound hackish, but you could subclass the UIButton and override the touch events and do you magic if [touch tapCount] == 2.

Don't start throwing stuff! I know it's not elegant.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜