UIScrollView无反应

问题描述:

我有一个UIViewControllerUIScrollView里面,所有内容都正确显示在滚动视图中,但由于某种原因,我无法滚动它,所有按钮都没有响应。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,我在不同的视图中使用相同的技术,并且它工作正常。 不知道我是否在这里失去了一些东西。

+0

你还没有写setScrollEnabled:YES .... – IronManGill

这样做希望能解决您的问题。

scrollView=[[UIScrollView alloc] initWithFrame:CGRectMake(0, 0,320, 460)]; 
[scrollView setScrollEnabled:YES]; 
[scrollView setContentSize:CGSizeMake(320,600)]; 
[self.view addSubView:scrollView]; 
+0

帮助,非常感谢! –