I have a UISplitView
like design (not really UISplitView
, I used View container
to mimic it).
The left side container has a table view
and right side container has a collection view
.
If I click the tableview cell
in the left container, the right side collection view
will be changed accordingly.
The collection view
is paginated, it always has two pages.
If I scroll to the second page of the collection view
and now I click a new table view cell
in the left container, it will load the correct collection view
in the right container, but it is in the second page instead of the first page!
I search around and could not find a solution.
I appreciate for any advices.
Update: Added related code.
Following code is in the right container
.
- (void)viewDidLoad
{
[super viewDidLoad];
[self setup];
self.collectionView.delegate = self;
self.pageControl.currentPage = 0;
[self.collectionView scrollRectToVisible:CGRectMake(0, 0, self.collectionView.frame.size.width, self.collectionView.frame.size.width) animated:NO];
}
The function setup
is defined as following:
-(void)setup
{
self.collectionView.pagingEnabled = YES;
self.collectionView.directionalLockEnabled = YES;
self.collectionView.bounces = NO;
self.collectionView.showsHorizontalScrollIndicator = NO;
}
Thanks.