iOSアプリ開発のメモ置き場

ささたつがiOSアプリ開発で知ったObjective-Cのtipsなどを書いていく所存

チャットライクな UI で新しい内容だけをひょこっと表示する方法

scrollToRowAtIndexPath:atScrollPosition:animated: メソッドで任意のセルの場所までスクロールできる。

int section = [self.tableView numberOfSections] - 1;
int row = [self.tableView numberOfRowsInSection:section] - 1;

NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section];

[self.tableView scrollToRowAtIndexPath:indexPath
                      atScrollPosition:UITableViewScrollPositionBottom
                              animated:YES];
}