gpt4 book ai didi

ios - 排除长按识别器的特定区域

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

我有一个方法可以在我的 Collection View 单元格的左上角添加按钮,以及长按识别器。问题是,当我将 longPressRecognizer minimumPressDuration 设置为 0.0001 之类的值时,我无法点击按钮,因为点击按钮不会激活 longPressRecognizer 方法。请看一下:

    UIButton *button = [UIButton buttonWithType:UIButtonTypeContactAdd];

[[RACObserve(self, shouldEdit) deliverOnMainThread] subscribeNext:^(id x) {

UIButton *button = [UIButton buttonWithType:UIButtonTypeContactAdd];
if (self.shouldEdit){

self.layout.longPressGestureRecognizer.minimumPressDuration = 0.1;

int ind = indexPath.row;
NSLog(@"1 blk called");
button = [UIButton buttonWithType:UIButtonTypeContactAdd];
[button addTarget:self
action:@selector(aMethod:)
forControlEvents:UIControlEventTouchUpInside];
[button setTag:indexPath.row];
[cell addSubview:button];

[button mas_makeConstraints:^(MASConstraintMaker *make) {

make.left.equalTo(cell.mas_left).with.offset(0);
make.top.equalTo(cell.mas_top).with.offset(0);
make.width.height.equalTo(@(20));

}];

}

我使用 react 性 cocoa 和砌体,但这实际上并不重要,我想要的是从区域中排除按钮区域,我可以将其用于 longGestureRecognizer

最佳答案

self.layout.longPressGestureRecognizer.minimumPressDuration = 0.1;

你可以使用 self.myview.longPressGestureRecognizer.minimumPressDuration = 0.1;并且在我的 View 中不要在我的 View 中放置按钮。这样你就可以点击按钮

关于ios - 排除长按识别器的特定区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36836734/

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