からUITableView
継承しUIScrollView
ているため、次のようなものを使用できます。
- (void)viewDidAppear:(BOOL)animated{
[table setContentOffset:CGPointMake(0.0, table.contentSize.height - table.bounds.size.height)
animated:NO];
[tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[musicGenre count]-1 inSection:0]
atScrollPosition:UITableViewScrollPositionBottom
animated:YES];
}
編集:
上から下への最初の動きもアニメーション化したい場合は、次のようにします。
- (void)viewDidAppear:(BOOL)animated{
[table setContentOffset:CGPointMake(0.0, table.contentSize.height - table.bounds.size.height)
animated:YES];
[tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:[musicGenre count]-1 inSection:0]
atScrollPosition:UITableViewScrollPositionBottom
animated:YES];
}
しかし、ユーザー エクスペリエンスを考慮してください。それだけの量のアニメーションが必要ですか? ユーザー (特にアプリを頻繁に使用する場合) は時間を無駄にしたくないからです。アニメーションは、ユーザー エクスペリエンスを向上させ、ワークフローの遅延を引き起こさない場合に優れています。
EDIT2:(現在の位置から)上にスクロールするには、次を使用できます:
[table setContentOffset:CGPointZero
animated:YES];