Apple のサンプル「PageControl」から、UIPageControl を使用してスクロールビュー内のページの移動を制御できることがわかります。
UITableView は UIScrollView のサブクラスなので、UIPageControl を使用して、「PageControl」のようにテーブル ビュー セルの移動を制御したいと考えています。
しかし、それを行うためのデリゲートのインターフェイスが見つかりません。
質問は:
これを行うことは可能ですか?なぜ ?
ありがとう
私の質問に次のように答えさせてください。
プログラムによる選択とスクロール
コード リスト 6-5 プログラムによる行の選択
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)newIndexPath {
NSIndexPath *scrollIndexPath;
if (newIndexPath.row + 20 < [timeZoneNames count]) {
scrollIndexPath = [NSIndexPath indexPathForRow:newIndexPath.row+20 inSection:newIndexPath.section];
} else {
scrollIndexPath = [NSIndexPath indexPathForRow:newIndexPath.row-20 inSection:newIndexPath.section];
}
[theTableView selectRowAtIndexPath:scrollIndexPath animated:YES
scrollPosition:UITableViewScrollPositionMiddle];
}