それぞれUITableViewCell
の内にUITableView
があり、UIScrollView
です。スクロールビューは、ユーザーが右にスワイプするとメニューが表示されるように設定されています。これは、iPhone Twitterアプリのセルの動作に似ています。ユーザが別のセルをスワイプすると、すべての目に見えるセルを反復して、UIScrollView
にセル内容(すなわち、その初期位置)にスクロールするように指示する。私があれば私の質問があるUITableViewでセルを反復するコスト
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
for(NSUInteger section = 0; section < [[self tableView] numberOfSections]; section++) {
for(NSUInteger row = 0; row < [[self tableView] numberOfRowsInSection:section]; row++) {
UITableViewCell *cell = [[self tableView] cellForRowAtIndexPath:[NSIndexPath indexPathForRow:row inSection:section]];
// resetting cell here
}
}
}
:私はそうのような様々なものをリセットするために、すべてのセルの上に再び繰り返す方法viewDidDisappear
で
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
if([scrollView tag] == 90) {
NSLog(@"Dragging a scroll view inside a cell!");
for (UITableViewCell *cell in self.tableView.visibleCells) {
[(UICellContentScrollView *)[cell viewWithTag:90] scrollRectToVisible:CGRectMake(0.0f, 0.0f, 320.0f, [cell frame].size.height) animated:YES];
}
}
}
:反復は次のコードでscrollViewWillBeginDragging
方法で行われます(a)適切な方法を取ること、(b)テーブルビューが50個(100個以下)のアイテムを格納している可能性があることを考えると、より良い解決策を提案する人はいますか?