小技巧UITableView滚动到指定Cell
2018-03-28 本文已影响12人
隐身人
/*_selectedInt 是需要选中的Cell 位置*/
NSInteger selectedIndex = _selectedInt;
NSIndexPath *selectedIndexPath = [NSIndexPath indexPathForRow:selectedIndex inSection:0];
[_testTableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];//选中指定cell选中状态
[_testTableView scrollToRowAtIndexPath:selectedIndexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];//cell滚动到选中指定cell位置