【发布时间】:2012-01-05 11:58:24
【问题描述】:
我有两个 UI 按钮,我想在两者上实现 Longpressgesture。
所以我写了下面的代码..
-(void)viewdidLoad
{
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(buttonLongPressed:)];
longPress.minimumPressDuration = 0.5;
[Button1 addGestureRecognizer:longPress];
[Button2 addGestureRecognizer:longPress];
}
- (void)buttonLongPressed:(UILongPressGestureRecognizer *)sender
{
if(sender.state == UIGestureRecognizerStateBegan)
{
}
}
现在我的疑问是如何检查哪个按钮是长按?
谢谢 兰吉特
【问题讨论】:
标签: ios