amomin
amomin

Reputation: 406

didSelectRowAtIndexPath does not push new view controller and also no error

I have a newb question. I have a table view controller that's working fine at first glance. It prints all the rows from my Nsmutabledictionary. When I click on a row, it fires this function as expected without crashing or giving system errors:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]];

    SCInventoryLeaf *childView = [storyboard instantiateViewControllerWithIdentifier:@"inventoryleaf"];

    NSArray *keys = [arrInventory allKeys];
    id aKey = [keys objectAtIndex:indexPath.row];
    id anObject = [arrInventory objectForKey:aKey];
    childView.title = aKey;
    childView.price = [anObject objectForKey:@"price"];

    [self.navigationController pushViewController:childView animated:YES];
}

But for some reason, my childView is not presenting itself after the onRowClick. I did properly name the identifier in my storyboard.

What could be wrong? Where shoudl i troubleshoot next?

Edit -- I shold also mention that I put some breakpoints in viewDidLoad of SCInventoryLeaf.m, but they never seem to get fired. So I'm guessing the SCInventoryLeaf.m is never used? But I'm pretty sure I eastblished a relationship ebtween my tblviewcontroller and scinventoryleaf....

Upvotes: 1

Views: 246

Answers (1)

stevekohls
stevekohls

Reputation: 2255

Put in a breakpoint and check to see that childView is not equal to nil. If it is, double-check that "inventoryleaf" is the correct case. Did you spell it "InventoryLeaf"? Cut and paste from your storyboard if needed.
The rest of your code looks fine.

Upvotes: 2

Related Questions