0

Ok so what do I want to achieve: I have a table view controller and a normal view controller. In the table view controller there a bunch of values from an array.

What I want: when the user selects a cell with the value of a particular array I want the view controller to display detailinfo about that cell.

For some reason dragging the segue in the storyboard doesn't really work, I can drag it but it doesn't push the screen of the second viewcontroller when I select a cell.

This is the code I have to solve this + I thought about adding an indicator of which cell was tapped. But when the second view controller is loaded the pickedRow value = 0 again.

This is the code for the FirstViewController.m

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    SecondViewController *secondView = [[SecondViewController alloc]init];
    secondView.pickedRow = indexPath.row;
    [self performSegueWithIdentifier: @"artiestenDetailSegue" sender: self];
} 

In the viewDidLoad of SecondViewController I have this, this just always returns 0:

    if (pickedRow == 1) {
        detailLabel.text = @"eerste";
}

Everything is imported correctly and no errors. What could the issue be?

Buh Buh
  • 7,443
  • 1
  • 34
  • 61

1 Answers1

0

SecondViewController *secondView = [segue destinationViewController]; secondView.pickedRow = indexPath.row;

Larme
  • 24,190
  • 6
  • 51
  • 81
  • I guess you mean to put this in prepareforsegue because otherwise a segue is not declared? Well then indexpath.row doesn't work. I am really just a starter. – Lander Iphone Jun 11 '13 at 11:03