我有UIViewController
一个UIScrollView
内部,所有内容都正确显示在滚动视图中,但由于某种原因我无法滚动它并且所有按钮都没有响应。
UIScrollView *_scrollView;
_scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 768, 1024)];
_scrollView.pagingEnabled = YES;
_scrollView.showsHorizontalScrollIndicator = NO;
_scrollView.showsVerticalScrollIndicator = NO;
_scrollView.delegate = self;
_scrollView.backgroundColor = [UIColor redColor];
[self.view addSubview:_scrollView];
NSInteger yPos = 175;
for(Issue *issue in _dataModel.issues)
{
// Create some items and add them to the scrollview
[_scrollView addSubview:tmpItem.view];
yPos += 140;
}
_scrollView.contentSize = CGSizeMake(768, yPos + 50);
我正确设置了 contentSize,我在不同的视图中使用了相同的技术,并且效果很好。不确定我是否在这里遗漏了什么。