以下の内容はhttps://anton0825.hatenablog.com/entry/20120519/1338793656より取得しました。


複数のUITableViewのスクロールを同期させる

UITableViewをスクロールさせるとscrollViewDidScrollメソッドが呼ばれるらしいのでこれを使う。
まずスクロールしたらイベントが発生するようにする。

-(void)scrollViewDidScroll:(UIScrollView *)scrollView {
    [[NSNotificationCenter defaultCenter] postNotificationName:SCROLL_NOTIFICATION object:scrollView];
}

スクロールイベントを受け取ったらスクロールイベントを発生させたTableとスクロール位置を合わせればOK

- (void)viewDidLoad
{
    [super viewDidLoad];
    NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
    [center addObserver:self selector:@selector(receiveScrollNotification:) name:SCROLL_NOTIFICATION object:nil];
}

- (void)receiveScrollNotification:(NSNotification *)notification {
    UIScrollView *stockTableView = notification.object;
    self.tableView.contentOffset = stockTableView.contentOffset;
}

意外と簡単だった。




以上の内容はhttps://anton0825.hatenablog.com/entry/20120519/1338793656より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14