collectionView偏移到某一组某一行

时间:2021-07-08 15:03:05

NSIndexPath *collecIndexPath = [NSIndexPathindexPathForRow:0inSection:8];//偏移到某行某组

[self.myCollectionView scrollToItemAtIndexPath:scrollIndexPathatScrollPosition:UICollectionViewScrollPositionTopanimated:YES];

//附带tableview设置偏移量

NSIndexPath *tableviewIndexPath = [NSIndexPath indexPathForRow:1 inSection:3];


[tableView scrollToRowAtIndexPath:scrollIndexPath

                 atScrollPosition:UITableViewScrollPositionTop animated:YES];