views:

26

answers:

1

Hey!

I have my main ViewController which has a tabBar and a navBar.

My tabBar has 2 buttons, in the first view, I added to its navBar an Add button, which should call another view. That's working fine except that this view is being called on the other tab instead of the one where the button was clicked.

This is my code:

-(void)add:(id)sender
{
newItem *detailViewController = [[newItem alloc] initWithNibName:@"newItem" bundle:nil];

[navController pushViewController:detailViewController animated:YES];
[detailViewController release];

}

Why isn't it working?

A: 

Sorry, but how do you know it is added to the wrong viewcontroller? The pushViewController should just push a new viewcontroller into the navigationController that is calling it. Are you using the right navigationController?

notme
Oh, well... It's embarrassing but you are right. I was indeed using the wrong navigationController. Still kind of new to the whole iPhone thing, if that makes me look a little better. :) Well, thanks bringing my attention to that!
BeOliveira
no problem, i guess this site exits even to find this kind of solutions. :)
notme