I have an UIScrollView in which I display tweets. The scrollView is contained in a stack of views, the last of which has 4 gesture recognizers.
The scrollView is populated as follows:
- (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;
}
}
There are 20 objects in the timeline, and the first 4 are visible. However, the scrollView does not scroll and the touches are handeled by the gesture recognisers.
The scrollEnabled
property is set to YES, but for some reason this does not seem to work.
The contentSize is set to 463 * 3000 which is much less than the scrollView it self, but still it won't scroll.
Any ideas?
userInteractionEnable
toYES
for your scrollView and for your subView? – MaTTP