Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 10-23-2009, 07:37 AM   #1 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 7
Default Is it possible to reset UINavigationController?

Hi,

I have a problem involving the UINavigationController.

I have a application that have three view controllers that I'm switching between using the navigation controllers push and pop functionality.

The problem is this: I stand in the third view controller and makes a call to
[self.navigationController popToRootViewControllerAnimated:YES];
this brings me to the first view controller (which is exactly what I want) but when I then try to navigate to the second view controller I end up in the third for some reason.

Is there any way you can reset the navigation controller, or am I doing this the wrong way?

Cheers, Andreas
drisse is offline   Reply With Quote
Old 10-23-2009, 07:44 AM   #2 (permalink)
Registered Member
 
Join Date: Jun 2009
Location: Ypsilanti, Michigan
Age: 63
Posts: 1,526
Default

Quote:
Originally Posted by drisse View Post
...but when I then try to navigate to the second view controller I end up in the third for some reason.

Is there any way you can reset the navigation controller, or am I doing this the wrong way?...
I can't tell if you are doing the wrong way because you haven't posted the code that you use to determine which view controller to go to. That is probably where the error is. Post the code that does the push.

Robert Scott
Ypsilanti, Michigan
RLScott is offline   Reply With Quote
Old 10-23-2009, 08:08 AM   #3 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 7
Default

Quote:
Originally Posted by RLScott View Post
I can't tell if you are doing the wrong way because you haven't posted the code that you use to determine which view controller to go to. That is probably where the error is. Post the code that does the push.

Robert Scott
Ypsilanti, Michigan
This code is called each time the "camera" button in the rootVieController is pusched:

[self.navigationController setToolbarHidden:YES animated:YES];
if(self.cameraViewController == nil)
{
CollageCameraViewController *camView = [[CollageCameraViewController alloc] init];//WithNibName:nil bundle:[NSBundle mainBundle]];
self.cameraViewController = camView;
[camView release];

}
[self.navigationController pushViewController:self.cameraViewController animated:NO];}

Wrong?
drisse is offline   Reply With Quote
Old 10-23-2009, 11:19 AM   #4 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,129
Default

You aren't explaining your situation very well.

Is camera the 2nd or 3rd view controller?
Are you pushing the camera controller, but not actually seeing the camera controller?
Does the root view controller have the ability to push directly to the 3rd controller?
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Old 10-26-2009, 03:10 AM   #5 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 7
Default

Quote:
Originally Posted by BrianSlick View Post
You aren't explaining your situation very well.

Is camera the 2nd or 3rd view controller?
Are you pushing the camera controller, but not actually seeing the camera controller?
Does the root view controller have the ability to push directly to the 3rd controller?
The following code is called in the root view controller when the user decides to launch the camera.

Code:
if(self.cameraViewController == nil)
{
        CollageCameraViewController *camView = [[CollageCameraViewController alloc] init];//WithNibName:nil bundle:[NSBundle mainBundle]];
        self.cameraViewController = camView;
        [camView release];

}
[self.navigationController pushViewController:self.cameraViewController animated:NO];
The following code is called from CollageCameraViewController (second) after the user has taken his fotos:

Code:
if(self.renderView == nil)
{
        CollageRenderViewController *renderViewController = [[CollageRenderViewController alloc] initWithNibName:nil bundle:[NSBundle mainBundle]];
        self.renderView = renderViewController;
        [renderViewController release];
}
[self.navigationController pushViewController:self.renderView animated:YES];
The following code is called from CollageRenderViewController (third) when the user decides to go back to main (root) view:

Code:
[self.navigationController popToRootViewControllerAnimated:YES];
Now, if I try to push CollageCameraViewController (second), with the code above, again I end up in CollageRenderViewController instead, why is that?
drisse is offline   Reply With Quote
Old 10-26-2009, 09:04 AM   #6 (permalink)
Emphasizing Fundamentals
 
BrianSlick's Avatar
 
Join Date: Jul 2009
Location: NoVA / DC Area
Age: 36
Posts: 7,129
Default

I do not believe the problem is in this code.
__________________
BriTer Ideas LLC - Code review, consulting, development. PM for pricing.

SlickShopper 2 | Free NSLog utility | Leave a PayPal donation.

Are you a newbie? Things you should read:
BrianSlick is offline   Reply With Quote
Reply

Bookmarks

Tags
uinavigationcontroller

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 230
16 members and 214 guests
ADY, Alsahir, cacao, dacapo, Dani77, Desert Diva, djohnson, F_Bryant, HemiMG, jansan, M@realobjects, MarkC, prchn4christ, smethorst, spiderguy84
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,882
Threads: 89,228
Posts: 380,762
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jansan
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:53 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0