i have all that data with me in tableview but when i dont know how to transfer these values on section view when user press any cell
this is how i am getting values
[[jsonArray objectAtIndex:indexPath.row] objectForKey:@”number”];
now how to transfer these values to section
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell;
static NSString *CellIdentifier = @"Cell";
cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil ) {
NSLog(@" inside");
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
mainLabel = [[[UILabel alloc] initWithFrame:CGRectMake(10.0, 5.0, 220.0, 15.0)] autorelease];
mainLabel.tag =33;
// mainLabel.font = [UIFont systemFontOfSize:14.0];
[mainLabel setFont:[UIFont boldSystemFontOfSize:[UIFont smallSystemFontSize]]];
mainLabel.textAlignment = UITextAlignmentLeft;
mainLabel.textColor = [UIColor blackColor];
mainLabel.highlightedTextColor = [UIColor greenColor];
//mainLabel.autoresizingMask = UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleHeight;
[cell.contentView addSubview:mainLabel];
mainLabel.backgroundColor=[UIColor clearColor];
}
// NSDictionary *itemAtIndex = (NSDictionary *)[jsonArray objectAtIndex:indexPath.row];
//[cell setData:itemAtIndex];
mainLabel.text = [[jsonArray objectAtIndex:indexPath.row] objectForKey:@"number"];
NSLog(@" dicst 5@",stream);
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic -- create and push a new view controller
NSLog(@" push");
//**[[jsonArray objectAtIndex:indexPath.row] objectForKey:@"number"];** how to do this so i can access from section view
aDetail = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:aDetail animated:YES];
[aDetail release];
}
Define a property on your
DetailViewControllerto hold the data, and pass it to that before pushing the view controller onto the navigation stack. Equivalently, add an extra parameter to the view controller’s constructor. So given:either do:
or:
Then you can access your data from within the detail view controller. To add this property, you can do this:
This means that your
DetailViewControllernow has API for being told about the object it’s representing.