hachinoBlog

hachinobuのエンジニアライフ

画面表示時に指定したセルの位置を初期表示させる

該当のセルまでスクロールさせる方法。

NSIndexPath *indexpath = [NSIndexPath indexPathForRow:5 inSection:0]; //該当のセクションと行指定
[aTableView scrollToRowAtIndexPath:indexpath atScrollPosition:UITableViewScrollPositionTop animated:NO];

animatedはNOにしないと上まで突き抜けておかしくなった。。

画面遷移時には

- (void)viewDidAppear:(BOOL)animated

でやってあげると確実かな。