I have a UIViewController
which contains several UITableViews
. You can swipe through the UITableViews
using a pagecontrol.
Now in another UIViewController
you can navigate to a certain UITableView
. I do it as following. In my prepareForSegue
in the viewController
I set a pageNumber
. Then In my other UIViewController
I am doing this.
-(void)jumpToPage:(NSNumber *)page{
NSLog(@"jump to page");
float offset=30;
float height = self.scrollView.bounds.size.height;
float width = 320 - (2*offset);
int pagee = [page intValue] - 1;
float x = (320 * pagee) + offset;
NSLog(@"X is %f",x);
[self.scrollView scrollRectToVisible:CGRectMake(x, 0, width , height) animated:NO];
}
This is causing that my UIScrollView
is not scrollable anymore.
I don't know if it is important but this is what I'm doing in my viewWillAppear
-(void)viewWillAppear:(BOOL)animated{
// Set up the content size of the scroll view
CGSize pagesScrollViewSize = self.scrollView.frame.size;
self.scrollView.contentSize = CGSizeMake(pagesScrollViewSize.width * self.pageStages.count, pagesScrollViewSize.height);
[self loadVisiblePages];
[self updateDay];
}
Can anybody help me with this??
EDIT
I've added this at the end of the jumpToPage method
NSLog(@"content size is %d",320 * self.pageStages.count);
self.scrollView.contentSize = CGSizeMake(320 * self.pageStages.count, self.scrollView.bounds.size.height);
But this has still no effect.