gpt4 book ai didi

ios - 满足特定条件时检测 LongPress

转载 作者:行者123 更新时间:2023-11-28 21:25:28 24 4
gpt4 key购买 nike

我在我的集​​合 View 中使用 UILongPressGestureRecognizer,我希望长按手势识别器只有在满足特定条件时才能工作。

NSString *check;
if([check isEqualToString:@"Enabled"]
{
//long press should be detected. or following method should be called
}

-(void)handleLongPressGesture:(UILongPressGestureRecognizer *)gestureRecognizer

{
}

最佳答案

添加 UIGestureRecognizerDelegate

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{

NSString *check;
if([check isEqualToString:@"Enabled"]
{
//long press should be detected. or following method should be called
return YES;
}else{
return NO;
}
}

关于ios - 满足特定条件时检测 LongPress,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38320992/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com