0

最初のテーブルビュー行データを2番目の詳細ビュー行に渡すにはどうすればよいですか

私が使う [cell setAccessoryType:UITableViewCellAccessoryDetailDisclosureButton];

また

cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;

各セルに開示ボタンを表示する

それはできます、私もアクションを追加します

- (void)tableView:(UITableView *)tableViewaccessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{

NSLog(@"disclosure button %@ touched",indexPath.row);   

}

しかし、開示ボタンをタッチすると、コンソールに何も表示されません。

にアクションを追加するより

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

// carry Alarm Name text into sub-table-view to look for detail time and text info
NSLog(@"Alarm Name = %@", [alarmName objectAtIndex:indexPath.row]);
NSLog(@"Index Path Raw# = %i", indexPath.row);

// Navigation logic may go here. Create and push another view controller.
AlarmDetailTableViewController *detailViewController = [[AlarmDetailTableViewController alloc] initWithNibName:@"AlarmTableViewController" bundle:[NSBundle mainBundle]];
// ...
// Pass the selected object to the new view controller.

[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
 detailViewController = nil;

}

コンソールモードで通知できます

ただし、第1レベルのTableViewの行に触れると、常に同じ詳細ビューが表示されると思います

レベル1のデータを使用して新しい詳細ビューを表示するにはどうすればよいですか?

例えば

tableView1.row0.text =detailview.titleを作成するには

タイトルの下に他のデータを表示します

コードが必要な場合はアップロードできます

私の上司はそれが内部の大きな秘密ではないと言いました...

どうもありがとう

4

2 に答える 2

3

おそらく問題はあなたにあります:

- (void)tableView:(UITableView *)tableViewaccessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{

読んでいるはずです:

- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath{
于 2010-10-08T21:11:44.787 に答える
0

OK、別の詳細ビューを表示するよりもアクセサリ ボタンをタップした場合

詳細ビューを追加する必要があります

最初に " new navigation based application" を作成します。例: FirstView

クラス フォルダを右クリックし、「add new File」を選択します。表示する新しいビューを選択します。

ex " DetailView"という名前の新しいテーブルビューを選択しました

最初に DetailView.m に移動し、セクションと行番号を指定します

またはレイアウトを宣言します

FirstView.h に戻るより

追加#import DetailView

FirstView.m に移動

この方法を見つける- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath

DetailView サブクラスを使用して新しいビューを作成します

このようなコードを追加します

DetailView *detailView =[[DetailView alloc]init];
detailView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self.navigationController pushViewController:detailView animated:YES];

表示したい任意のビューを追加できます

于 2010-10-05T01:35:52.483 に答える