我有一个UISplitView
类似的设计(不是真的UISplitView
,我曾经View container
模仿它)。
左侧容器有一个table view
,右侧容器有一个collection view
。
如果我单击tableview cell
左侧容器中的 ,右侧collection view
将相应更改。
是分页的collection view
,它总是有两页。
如果我滚动到第二页,collection view
现在我table view cell
在左侧容器中单击一个新的,它将collection view
在右侧容器中加载正确的,但它在第二页而不是第一页!
我四处寻找,找不到解决方案。
我很感激任何建议。
更新:添加了相关代码。
以下代码在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];
}
函数setup
定义如下:
-(void)setup
{
self.collectionView.pagingEnabled = YES;
self.collectionView.directionalLockEnabled = YES;
self.collectionView.bounces = NO;
self.collectionView.showsHorizontalScrollIndicator = NO;
}
谢谢。