views:

280

answers:

2

hi i am making an application of iphone, in which i hav one view name dealsviewcontroller, in this view i have table view in each row i am showing 3 arrays values. now the problem is that i have to shows these arrays values in next view in separate label. if anyone has any solution of this, it would be greatly apreciated. Thanx in advance

A: 

Create a new view controller for the next view, something like DealDetailsViewController. Then, make sure it has a property dealDetails that can store your data structure, for instance:

@property (nonatomic, retain) DealDetails *dealDetails;

Then in your UITableViewDelegate implementation (probably DealsViewController) implement tableView:didSelectRowAtIndexPath: to determine the selected deal and passing it along to an instance of DealDetailsViewController:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{
    // Determine the selected value using indexPath.section and/or indexPath.row

    DealDetails *dealDetails = [myArrayOfDealDetails objectAtIndex: indexPath.row];

    DealDetailsViewController *dealDetailsCtrl = [[DealDetailsViewController alloc] initWithNibName: @"DealDetailsViewController" bundle: nil];

    dealsDetailCtrl.dealDetails = dealDetails

    // Assuming you have a navigationController somewhere
    [someNavController pushViewController:dealDetailsCtrl]
}
MathieuK
hi MathieuK, i am using 3 arrays in one row of tableview and i want to show the all 3 arrays values as per selected row. i have already done with showing one array values but don't know how to show 3 arrays values in separate labels.
A: 
Niels Hansen