我在 UIScrollView 上的 UIView 下方有大约 900 像素的 UIButtons/UISliders。我在 0,0,375,950 处分配/初始化 scrollView 和 UIView 框架,并将 scrollView.contentSize 设置为相同并启用了 userInteraction。然而,我无法与屏幕尺寸以下(675 y 之外)的任何控件进行交互。
self.viewInsideScrollView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 375, 950)];
self.viewInsideScrollView.userInteractionEnabled = YES;
self.scrollView.contentSize = CGSizeMake(self.viewInsideScrollView.frame.size.width, self.viewInsideScrollView.frame.size.height);
self.scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 375, 950)];
self.scrollView.delegate = self;
self.scrollView.scrollEnabled = YES;
self.scrollView.userInteractionEnabled = YES;
self.scrollView.scrollsToTop = YES;
self.scrollView.clipsToBounds = YES;
[self.scrollView addSubview:self.viewInsideScrollView];
按钮、滑块和一个 colletionView 都通过 Storyboards 添加并约束到 scrollView 顶部的 UIView