gpt4 book ai didi

ios - 识别 UIScrollView 中的滑动手势

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:15:10 25 4
gpt4 key购买 nike

我正在尝试识别 UIScrollView 中的滑动手势,我使用下面的代码添加了 ScrollView ,并在我的 Storyboard中添加了滑动手势,并在手势被识别时使用自定义转换。

.h文件

@interface PLProfileViewController : UIViewController {
IBOutlet UIScrollView *scroller;
}

.m文件

- (void)viewDidLoad {
[super viewDidLoad];
[scroller setScrollEnabled:YES];
[scroller setContentSize:CGSizeMake(320, 875)];
}

ScrollView 本身工作正常,但自从添加它之后,所有之前工作的手势识别器都不再工作了。你知道我该如何解决这个问题吗?

非常感谢您,

最佳答案

UIGestureRecognizer 添加到您的 UIScrollView 中,同时从 UIGestureRecognizerDelegate 中实现以下方法:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer;

关于ios - 识别 UIScrollView 中的滑动手势,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30595316/

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