我有一个UIScrollView,用于显示推文。这个scrollView包含在一组视图中,最后一个视图有4个手势识别器。
scrollView的填充方式如下:
- (void) createTimeLine:(NSArray*)timeline
{
CGRect rect = CGRectMake(0, 0, 463, 150);
NSInteger i = 0;
NSLog(@"timeline objects: %d", timeline.count);
self.scrollView.contentSize = CGSizeMake(463, timeline.count * 150);
for (NSDictionary *d in timeline) {
SingleTwitViewController *c = [[SingleTwitViewController alloc] initWithAsingleTwit:d];
rect.origin.y = i * 150;
c.view.frame = rect;
[scrollView addSubview:c.view];
[scrollView bringSubviewToFront:c.view];
i += 1;
}
}
时间轴中有20个对象,前4个是可见的。然而,scrollView不滚动并且触摸由手势识别器处理。
scrollEnabled
属性被设置为YES,但出于某种原因,它似乎不起作用。
contentSize被设置为463 * 3000,远小于scrollView本身,但仍然无法滚动。
有什么想法?
userInteractionEnable
为YES
? - MaTTP