「タイトル」キーでUITableViewをコンパイルするplistがあります。plistは下にあります。テーブルビューは正しく入力されます。これを使用してViewControllerをプッシュします。
- (void) tableView: (UITableView*) tableView didSelectRowAtIndexPath: (NSIndexPath*) indexPath;
{
LocationsReviewViewController *nextViewController = [[LocationsReviewViewController alloc]init];
NSDictionary *rowData = [[[tableData objectAtIndex: indexPath.section] objectForKey: @"Rows"] objectAtIndex: indexPath.row];
nextViewController.title = [rowData objectForKey: @"Title"];
[self.navigationController pushViewController: nextViewController animated: YES];
}
nextViewController
テーブル内のどのオブジェクトが選択されたかに関する情報を保持するために、上記を取得するにはどうすればよいですか?nextViewController
さらに、新しいビューで各サブツリーキーに含まれる文字列を表示するにはどうすればよいですか?そのViewDidLoadはどのように見えるべきですか?
これが、現在、nextViewControllerのViewDidLoadがどのように見えるかを示しています(説明はUILabelです)。「LAPlace1」の行が選択されているときに@「3001Sunset」が表示されないのはなぜですか。
- (void)viewDidLoad
{
[super viewDidLoad];
NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Data3" ofType:@"plist"]];
NSDictionary *subtree = [dictionary objectForKey: @"Subtree"];
description.text = [NSString stringWithFormat:@"%@",[subtree objectForKey:@"Item 2"]];
}
<array>
<dict>
<key>Rows</key>
<array>
<dict>
<key>Subtree</key>
<array>
<string>Los Angeles, CA</string>
<string>Tuesday</string>
<string>3001 Sunset</string>
</array>
<key>Title</key>
<string>LA Place 1</string>
</dict>
<dict>
<key>Subtree</key>
<array>
<string>New York, NY</string>
<string>Sunday</string>
<string>1400 Broadway</string>
</array>
<key>Title</key>
<string>NYC Place 1</string>
</dict>
<dict>
<key>Subtree</key>
<array>
<string>Austin, TX</string>
<string>Sunday</string>
<string>2400 Lamar Blvd</string>
</array>
<key>Title</key>
<string>Austin Place 1</string>
</dict>
</array>
<key>Title</key>
<string>Section1</string>
</dict>
</array>
</plist>