これを行う方法を見つけるのに苦労していますが、
これを UITableDetailView (ドリルダウン スタイル) で表示し、各アイテムを別のセルに表示したいと考えています。私が読んだすべてのものは、UITableViewとして表示するのではなく、詳細に単一の画像をロードする方法を示しています。正しくロードするには、辞書に「子」が必要ですか? JSON 行配列から *dict を作成する最初のビューのコードを次に示します。
私が探しているのは、FollowingDetailViewController.m に何を入れて残りの *dict コンテンツを表示するかだと思います。そのため、行を選択すると、残りの *dict が読み込まれます。
次のようにrowsArrayが返されます。
'{ loginName = ジョンソン;
メンバー ID = 39;
名前 = クリス;
年齢 = ;} などなど...
ありがとう、
// テーブルとセルのセットアップ
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
NSDictionary *dict = [rowsArray objectAtIndex: indexPath.row];
cell.textLabel.text = [dict objectForKey:@"name"];
cell.detailTextLabel.text = [dict objectForKey:@"loginName"];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
- (void)viewDidLoad {
[super viewDidLoad];
//GET JSON FROM WEBSERVICES:
NSURL *url = [NSURL URLWithString:@"http://10.0.1.8/~imac/iphone/jsontest.php"];
NSString *jsonreturn = [[NSString alloc] initWithContentsOfURL:url];
NSData *jsonData = [jsonreturn dataUsingEncoding:NSUTF32BigEndianStringEncoding];
NSError *error = nil;
NSDictionary * dict = [[CJSONDeserializer deserializer] deserializeAsDictionary:jsonData error:&error];
if (dict)
{
rowsArray = [dict objectForKey:@"member"];
[rowsArray retain];
}
[jsonreturn release];
}
//GO TO DETAIL VIEW:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
FollowingDetailViewController *aFollowDetail = [[FollowingDetailViewController alloc] initWithNibName:@"FollowingDetailView" bundle:nil];
[self.navigationController pushViewController:aFollowDetail animated:YES];
}