这个应用场景还是挺多的,代码如下:
//获取到需要跳转位置的行数NSIndexPath *scrollIndexPath = [NSIndexPath indexPathForRow:10 inSection:0];//滚动到其相应的位置[[self tableView] scrollToRowAtIndexPath:scrollIndexPath atScrollPosition:UITableViewScrollPositionTop animated:YES];
以下枚举决定滚动到指定位置的哪个位置
typedef NS_ENUM(NSInteger, UITableViewScrollPosition) { UITableViewScrollPositionNone, UITableViewScrollPositionTop, UITableViewScrollPositionMiddle, UITableViewScrollPositionBottom};