我有一个UICollectionView。此CollectionView打开索引号“0”但我希望它打开索引号“2”。我怎么做到的?
scrollView.setContentOffset(CGPoint(x: 0, y: cellHeight * 2), animated: false)
你可以在swift中使用这一行
取决于您的collectionViewcell高度(如果垂直滚动)
你可以添加[scrollView setContentOffset:CGPointMake(0,cellHeight *2) animated:NO];
在你的viewWillApear