ユーザーが特定のセクションに触れた場合、セクションのデータを別のビューに表示したい..誰かがそれを行う方法を教えてもらえますか?
4676 次
4 に答える
0
これが私が使ったものです。basiaclly彼らが言ったことですが、ここにある種の詳細ビューをロードしたい場合:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
DetailViewController *detail = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
detail.item =(MWFeedItem *)[items objectAtIndex:indexPath.row];
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detail animated:YES];
[detail release];
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
}
注:MWFeedItemは私のクラスの1つです。あなたはあなた自身を使うべきです
于 2010-07-13T22:27:34.590 に答える
0
セクションヘッダー(返されるテキスト)をタップしたいという意味なら、tableView:titleForHeaderInSection:
それは不可能だと思います...
代わりに使用してtableView:viewForHeaderInSection:
、テキストの上に透明なボタンを追加することもできます。このボタンに、セクションインデックスを保持する透明なテキストを追加することもできます。このようにして、すべてのセクションヘッダーボタンを同じセレクターに向けることができ、そのセレクターにセクション(ボタンのテキスト)があります...
于 2010-07-13T22:29:59.827 に答える
0
プロパティを使用-tableView:didSelectRowAtIndexPath:
してテストするだけです。indexPath.section
switch (indexPath.section)
case kFirstSection:
[self doSomethingWithCustomViewForSection:kFirstSection];
break;
case kSecondSection:
[self doSomethingWithCustomViewForSection:kSecondSection];
break;
...
default:
break;
于 2010-07-13T22:21:05.137 に答える
0
indexPath.section
didSelectRowAtIndexPath: メソッド内で使用して、選択したセルのセクションを決定できます。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSLog(@"%i",indexPath.section);
}
上記は、ユーザーが選択したセクションをコンソールに出力します
于 2010-07-13T22:23:03.507 に答える