0

Could somebody explain me what i'm doing wrong in the code below? I try to pass data from the didSelectRowAtIndexPath method but in the SizeViewController productKey has still value of null

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

                [tableView deselectRowAtIndexPath:indexPath animated:YES];
                SizeViewController *sizeViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"SizeView"];
                sizeViewController.title = [self.choosedProducts objectAtIndex:indexPath.row];
                sizeViewController.productKey  = [self.choosedProductsIds objectAtIndex:indexPath.row];
                [[self navigationController]pushViewController:sizeViewController animated:YES];

}

BlackSheep
  • 1,087
  • 12
  • 29
sonoDamiano
  • 185
  • 1
  • 12

2 Answers2

0

You are trying to load a view controller from storyboard,So it should be initialised as

SizeViewController* detailViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"SizeViewController storyboard identifier"];
Lithu T.V
  • 19,955
  • 12
  • 56
  • 101
  • I change my code but now the subview doesnt load and I have log info: Application tried to push a nil view controller on target . – sonoDamiano Nov 04 '13 at 11:50
0

Can u try to get a reference to the storyboard instead of using the self.storyboard property? It is just a guess.

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]];

Also, can u verify in your solution that sizeViewController is not nil?

Raphael Oliveira
  • 7,751
  • 5
  • 47
  • 55