日々精進

新しく学んだことを書き留めていきます

UITableViewの選択するセルをプログラムから操作するときの注意点

プログラムから先頭のセルを選択したい、という場合、以下のようにする。

[self.currentTableViewController.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:NO scrollPosition:UITableViewScrollPositionTop];

[NSIndexPath indexPathWithIndex]をつかうとエラーになるので注意。