How to get a UIScrollView embedded within a UITableCellView to scroll?
Posted
by Zan
on Stack Overflow
See other posts from Stack Overflow
or by Zan
Published on 2010-06-09T18:34:29Z
Indexed on
2010/06/09
19:12 UTC
Read the original article
Hit count: 366
I have a scroll view containing several images embedded within a custom cell view, it sometimes scrolls horizontally if I keep holding the cell for a while. I tried a lot of things and it doesn't seem to work, please help? Here's part of the CustomCell : UITableViewCell code:
-(void) layoutSubviews
{
CGRect scrollViewFrame = CGRectMake(0, 0, 320, 200);
self.scrollView.frame = scrollViewFrame;
self.scrollView.backgroundColor = [UIColor whiteColor];
self.scrollView.contentSize = CGSizeMake((320*3), 200);
self.scrollView.scrollEnabled = YES;
self.scrollView.clipsToBounds = YES;
self.scrollView.pagingEnabled = YES;
self.scrollView.showsHorizontalScrollIndicator = NO;
self.scrollView.showsVerticalScrollIndicator = NO;
self.scrollView.scrollsToTop = NO;
self.scrollView.delegate = self;
self.scrollView.userInteractionEnabled = YES;
// add 3 images to subview here
pageControl.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.7];
pageControl.frame = CGRectMake(0, 170, 320, 30);
pageControl.numberOfPages = 8;}
I tested the code on a UIViewController and it works just fine, I'm guessing that this is caused by cell selection and I tried returning nil when the cell gets selected and that didn't work.
I also tried passing touches to the scrollview and that didn't work either, please help?
© Stack Overflow or respective owner