UINavigationController popToRootViewControllerAnimated

I am pushing on several view controllers onto the navigation stack
[self.navigationController pushViewController:con animated:YES];
If the users switches over to another tab and "logs out", I try popping all of the controllers from the stack using
[self.browseRVC.navigationController popToRootViewControllerAnimated:NO];
I can see that all of the views (except the root) no longer exist in the navigation controller's viewControllers array. However, each of the view controller's that were popped from the stack "dealloc" methods are not being called. Shouldn't dealloc be called when a viewController is popped? If I hit the back button, dealloc is called.
Thanks for any help

It looks like it only gets called when you tap the tab of that particular navigation controller. Is this a bug? I need some way to "reset" my app when the user logs out and it looks like popToRootViewController isn't working correctly.

Similar Messages

  • UITableView with custom frame size within a UINavigationController... how?

    I've seen similar questions asked all over the web, but so far not a single "real" answer has cropped up, so hopefully you folks will know the way to do this.
    I have a main view that with a UIView subview, inside of which I am programmatically adding a UINavigationController and UITableView that is encapsulated in a +regular UIViewController+, to allow it to be pushed/popped onto the navigation controller. I'm essentially just trying to get a table+navcontroller combination that only takes up about half the screen height.
    The problem isn't that it doesn't work, because I have no problem getting the table and navigation controller working together as expected. The problem is that no matter what I do or try, I cannot get the table view to be smaller (in height), than full-size, meaning that when contained in this ~200px navcontroller-in-subview, there are a large number of rows the user cannot select because attempting to scroll to them immediately "bounces" back. You can see that the rows are there when you "pull" the scroll down, but can never get it to stay.
    As it appears, the table view is too large in height. I've gone as far as setting the table to a height of 10, to no avail. Autoresize masks have no effect.
    Please note that I'm NOT using an instance of UITableViewController, but rather the plain vanilla UIViewController, because creating an instance of the former automatically creates the underlying UITableView, which was always sized to large, as well. I had some advice that I should attempt creating the table and view controller independently, add the former to the latter and then push the view controller onto the navigation controller. Again, this does work, but the size is all out of whack.
    Finally, in quick psuedo-code, this is essentially what I'm doing:
    (this is found in MainViewController::viewDidLoad)
    CGRect frame = subviewContainer.frame;
    frame.size.height = 10;
    frame.origin.x = 0;
    frame.origin.y = 0;
    UITableView* table = [[UITableView alloc] initWithFrame:frame];
    table.autoresizesMask = UIViewAutoresizingNone;
    UIViewController* tVC = [[UIViewController alloc] init];
    tVC.view = table;
    UINavigationController* navC = [[UINavigationController alloc] initWithRootViewController:tVC];
    [subviewContainer addSubview:navC.view];
    Thanks for any tips you might have: this is quite the frustrating problem!

    I have an app that is absolutely kicking my butt. I have a UITabBarController that contains a UINavigationController that contains a custom UIViewController. When the user rotates the iPhone, I want to hide the navigation bar, hide the tab bar and swap out a UIImageView in the custom view controller and I want the image to be full-screen. I've figured out how to get rid of the navigation and tab bars, but making the UIImageView full-screen is what's killing me. When the image shows up, it is the size it would be if the tab bar was visible. In the didRotateFromInterfaceOrientation method, I hide the tab bar by doing:
    tabBar.hidden = YES;
    I've tried resizing the UIImageView by doing:
    img.frame = CGRectMake(0.0, 0.0, 320.0, 480.0);
    but that just screws up the image even more. I tried resizing the tabBarController's view, and I've tried resizing the current view, but alas to no avail.
    Can anyone help me not be stupid?
    Thanks!

  • In UINavigationController can't go back any solution

    hi,
    In my application i have used UINavigationController and it goes to another view easily.
    Means is navigate successfully but when i press back button previous view is also coming but then apps get hang.
    So any solution for that?????? how can i make my apps successfully runin g?????.
    Thanks.

    could be a few things.
    do you have anything going on in viewWill(Did)Load in the first view?

  • IB + UINavigationController

    Hello..
    Does anybody know how IB + UINavigationController are working together? Or any hints what i have to take care of? It seems, that it is a bit confusing to bring IB into action for more complex things.. I spent much time now with IB but i think i should just concentrate on programming everything without IB now..
    My Problem;
    I have a mainWindow.xib which has a TabBar (its the tabBar example from xcode)..
    Each Tab should show a TableView where each of this TableViews should have a NavigationBar (with navigtionController) or visa verca; each TabBar Item should have a navigationController holding a TableView (this is more correct)
    what i want: if someone is clicking on one cellItem (on one row in the table) just a new TableView (controlled from navigationController) should appear.
    How i can implement this just programmatically is clear.. *but not with IB*.
    Example;
    if i am calling
    MyViewController *aViewController = [[MyViewController alloc] initWithNibName:@"MyNextView" bundle:nil];
    self.myViewController = aViewController;
    [aViewController release];
    NSLog(@"pushing next view..");
    [[self navigationController] pushViewController:nextViewController animated:YES];
    from a view which is inside* my mainView.xib, everything works fine. but
    if, for example my nextView has a further "nextView" (lets name it secondNextView) then, "pushing next view" is shown as string to the console. so far, so good. but i dont see my secondNextView (which is called from my nextView).
    the next interesting thing is that if give my nextView a NavigationBar with a title - the title is never shown. Just the backItem to the previous view. Therefore, i think what i m still not understanding is how i can link the naviController from a secondView to its previousView and visaVersa with IB if the views are in different XIBs.
    hm...
    any help or comment is appreciated..
    thx,
    sommeralex
    *inside:
    Tab Bar Controller
    ..TabBar
    ..MyViewController
    ....NavigationBar
    ....Table View Controller
    ......Tab Bar Item
    ..and so on

    fixed (sollution will be published)

  • [iPhone] UITabBar, UINavigationController, etc.

    I am very new to iPhone and Cocoa/Obj-C, but have been working in the .NET world for quite some time building WM apps using the .NET Compact Framework.
    Let's say I have an application design that uses a tab view with 3 tabs as its main UI metaphor. In the first 2 tabs, I want to have navigation controllers, and in the last tab I want to have just a simple view.
    The first tab is the hardest, since I need the navigation controller to be able to switch out its top-level view between a table view and a graphical representation of the data in the table. This might be a UIWebView, but I don't know that yet. Interacting with either of these top-level views should push onto the navigation controller's stack a new view with some detail information about the list item selected. In the top level view, I need the navigation bar to display a left "refresh" button, a center "segment controller" with 2 segments, and a right "edit" button. The center segment controller will be used to toggle between the base table view and the graphical view. Is there a way to just swap the top level views of a navigation controller? When an item is selected and the detail view is pushed onto the stack, the navigation bar of the detail view needs to change to provide the typical "Back" button and possibly some other right button (to be determined). Is this even possible? Does it have to be done in code, or can I use IB to do it?
    The second tab is a relatively simple table->detail navigation scheme. I might add some functionality to it later, but for now that's all I need.
    I guess my biggest question would be: what are some best practices for getting this done? I think I would prefer to use IB, as this allows me to better see the UI I am crafting, but I am not "married" to it, per se.
    As to hooking into the tab bar, I would like to be able to decompose the problem into the various views that will be used for each tab, and then add those views to the tab bar. In the IB examples I've seen (including the UITabBar template project in XCode), the tab bar is configured to have tabs that "are" navigation controllers, and the navigation bar is laid out directly within the tab bar view. Is that really a "best practice," or is it more correct to set each tab's view to be a separately crafted class that may or may not be a UINavigationController or UITableViewController UIViewController or whatever?
    Thanks for whatever assistance you can offer,
    Matthew

    We bought two white 3G iPhones on launch night.
    Neither of them has exhibited any cracks, dust, or dead pixels yet (knock on wood). In terms of construction, they are good, except I don't really like the SIM card insert-it doesn't look well aligned compared to the almost seamless aluminum insert of the first gen iPhone.
    I've heard of the cracking issue (never seen it), but never the dust under screen one or leaking backlight one.
    My first gen iPhone has one dead pixel now, after over a year. (its amazing how on even a small screen that can get annoying) That would be one issue I would check first.
    For all the hassles of getting your phone activated in store (compared to last time), the one advantage is, if you have the time, you can completely examine your phone before you leave, with a Genius standing right there.
    Good luck!

  • Want to use pushViewController and segues from UINavigationController in AIR app on iOS

    Ok, this might be a long shot, but here goes.
    My iOS AIR app includes a bunch of native screens defined in a storyboard.  I have them included by putting them into a native (static) framework, including that framework in an ANE, and adding code to instantiate and add the various ViewControllers to the screen.
    I can add a ViewController as a child and get its view to show on the screen with the following obj-c code in my ANE:
    [[[[UIApplication sharedApplication] keyWindow] rootViewController] addChildViewController:controller];
            [[[[UIApplication sharedApplication] keyWindow] rootViewController].view addSubview:controller.view];
            [controller didMoveToParentViewController:[[[UIApplication sharedApplication] keyWindow] rootViewController]];
    However, some of the views have child views that use segues and the push stack from UINavigationController.  When these screens try to load, I get the following error:
    Apr 21 13:50:43 raspberry LKW_Smash[7703] <Error>: *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Could not find a navigation controller for segue 'MemberOptionsSegue'. Push segues can only be used when the source controller is managed by an instance of UINavigationController.'
    So I attempted to get access to the app's UIViewController, and push the new ViewController onto the stack with the following code:
    [root.navigationController pushViewController:controller animated:YES];
    But root.navigationController is nil!  It looks like the app doesn't have one!
    So after all that, my question is this: How do I create an AIR app that includes a UINavigationController and is not simply just a single-view app?

    Sync the contacts on your Mac with Google Contacts as well... There is no need to involve iCloud.
    Perhaps you should take a look at Google's help pages.

  • How can i set image on UINavigationController

    Hey Friends,
    I have to set our company's logo on UINavigationController
    so anybody know how to set image on UINavigaionController and is it possible or not???
    Thanks,
    haresh.

    A navigation bar shows one navigation item at a time so yes, you do want to set the image on the navigation item and not the navigation bar.
    One trick is to add code to your navigation controller's delegate method 'willShowView'. This method is passed the view controller about to be shown. Get the navigation item from the view controller. Then check to see if the navigation item has your custom title view or not. If not, set it with your custom view and logo.

  • UITabBar/UINavigationController issues with IB

    I'm unable to get nibs with UITabBar and a UINavigationController to work. Not sure if I'm doing this right since there's no docs, but here are the steps to reproduce:
    1. Drag a UITabBarController into the nib window
    2. Drag a UINavigationController into the nib window
    3. Make a connetion from the TabBarController's viewControllers outlet to the NavigationController
    4. Load the nib in you iPhone application
    I get the following exception when loading the nib:
    NSInvalidArgumentException, * -[NSCFArray insertObject:atIndex:]: attempt to insert nil
    I've tried many different combinations of setting this up, but I always get this same exception.
    Has anyone been able to setup a UITabBar with NavigationControllers in it? How did you do it?
    thanks,
    -=Scott

    Perhaps you already found a solution to issue... but in case you havent...
    The beta IB seems to be quirky so I am doing most of my view configuration manually.
    In lieu of IB based implementation here is a code snippet to create the UITabBarController and UINavigationController combination...
    - (void)applicationDidFinishLaunching:(UIApplication *)application {
    // Create a window
    window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    // Create TabBar view controller and associated view controllers for the its TabBarItems.
    tabBarController = [[UITabBarController alloc] init];
    CustomViewController1 *viewController1 = [[CustomViewController1 alloc] init];
    UINavigationController *navController1 = [[UINavigationController alloc] initWithRootViewController: viewController1];
    [viewController1 release];
    CustomViewController2 * viewController2 = [[CustomViewController2 alloc] init];
    UINavigationController *navController2 = [[UINavigationController alloc] initWithRootViewController: viewController2];
    [viewController2 release];
    tabBarController.viewControllers = [NSArray arrayWithObjects:navController1, navController2, nil];
    [navController1 release];
    [navController2 release];
    [window addSubview:tabBarController.view];
    // Display the window
    [window makeKeyAndVisible];
    The above code will create separate navigation bars for each of the tab bar "modes".
    Enjoy

  • Add UINavigationController without App Delegate

    I have been researching on how to add UINavigationController (I've been using UINavigationBars since) but all of them include putting the UINavigationController code in the App Delegate. The problem here is that only 2 view (root and detail) are the only ones that use UINavigationController and UITableViews. All my other views (10 so far, more to come) use modal transitions. So creating a UINavigationController in the appdelegate would be useless. How can I add a UINavigationController only in the .h & .m? And then push a detail view controller from a row (Only the top row, but I already have to code working on checking if the user taps on the first row. Right now when the user taps o the first row, it shows the next view in a modal tradition, but I want to replace it with push, but I know my current code works)? Also, the current view I want to be root contains (currently) a UINavigationBar with a done button (left side) and a custom bordered button (on the right), a UITableView, and a UIToolbar with 2 custom buttons and 3 flexible spaces. I need all of these shown (UInavigationBar will be replaced by UINavigationController and the done button needs to show only on the root view and get replaced by back button on the detail, and custom buton needs to remain there on both views.) Pushing view controllers and UINavigationControllers are new to me, I'm trying to grasp it.
    Message was edited by: TechGeniusApps

    Just create the the UINavigationController wherever you need to show its root view controller. With no storyboard segue you would typically use something like this. I initiated from a UIButton action for this example. Instead of a generic UITableViewController, use the custom view controller class of your root view controller (PauseMenuTableViewController?). If you are using old-school nib/xib, replace initWithStyle with initWithNibName.
    - (IBAction)showWhateverViewButtonClick:(id)sender {
        // create whatever view controller type will be the root of the navigation controller
        UIViewController *rootViewController = [[UITableViewController alloc] initWithStyle:UITableViewStylePlain];
        // create a navigation controller using that view controller for the root
        UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController];
        // show the navigation controller (modal)
        [self presentViewController:navigationController animated:YES completion:NULL];

  • UINavigationController for TabBar View in separate NIB

    Hi All,
    I have a UITabBar in a Main NIB file. if I add a generic UIViewController as a sub-component of the UITabBar I can specify a NIB file, and as long as the top-level object of that NIB is a UIView, everything loads properly. However, i want to basically create a UINavigationController based NIB and have that loaded as one of the TabBar views, can anyone give me some information on how to accomplish this?
    In other words, we have split up work over developers and each is going to take a few tabs of the overall application. One of the tabs uses a UINavigationController as the top level view controller. I need to know how to accomplish this with multiple NIB files.
    Thanks a bunch

    I had this problem as well- all views were loaded from a Tab Controller, but one I wanted a NavController to control table sub views. I finally solved it by:
    Make sure in IB, all the NIB names of the tab controller buttons are set- leave one Open. This is where you can then drop in a Navigation Controller.
    Set the View Mode to tree (rather than the default icon view) - this lets you see into the views.
    Drop a Navigation Controller onto the grey View area of the Tab View. Set the Class of the nav controller to whatever class you created to control it with.
    Now, inside the nav controller you have a view controller to drag and drop views onto.
    With the View mode in IB set to Icon, it's impossible to see the relationships- this is why it's best to work in tree view.
    Your tree will look something like this: (assume 4 buttons, 2nd button is the Nav Controller)
    File's Owner
    First Responder
    Delegate
    Window
    Tab Bar Controller
    -Tab Bar
    -(Some NIB)
    -Navigation Controller (expanded)
    --Navigation Bar
    --View Controller
    ---View
    ---Navigation Item
    --Tab Bar Item
    -(Some NIB)
    -(Some NIB)
    Hope it helps.

  • RunTime Error on iPhone for UINavigationController

    I have a UINavigationController in which the RootViewController loads an external nib file.
    The nib file has 8 buttons with 8 corresponding Outlets and 1 Action. I've created a class file for the .nib and assigned it to the nib's File Owner. I've then reconnected the view to the file owner.
    The RootViewController displays the nib fine. However, if I connect the Outlets to the buttons or "click" a button which executes the action, I get something like "[RootViewController placeCall:]: unrecognized selector sent to instance" in the Debugger Console.
    Remember, the outlets and the action are/in the class file for the nib, not the class file for the RootViewController.
    From the debugger, it seems as if the the RootViewController can't find any of my outlets even though they're attached in the IB.
    Any suggestions?
    Thanks.

    The class of the RootViewController needs to be set in two places since the object is created in MainView.xib and is also represented by the File's Owner proxy object in the nib that defines your controls. Make sure it's set to the same class name in both nibs.

  • Hellooo Frndz....:)  i have to use UISplitviewController.and I want to do add UISplitViewController To UINavigationController but problem is that i can't do this...:( :( :(  i use MGSplitViewController Bt I Dont know Perfectly Use Of MGSplitViewController

    Hellooo Frndz....:)
    i have to use UISplitviewController.and I want to do add UISplitViewController To UINavigationController but problem is that i can't do this...:(
    i use MGSplitViewController Bt I Dont know Perfectly Use Of MGSplitViewController...
    so pLz anyone can help me how to add UISpliViewController To UINavigationController ???
    ===> Thnxs...:)

    thanks..K  T
    you can give me any idea for how to Create My Own Interface for Add UISplitViewController to UINavigationController ...Becouse I was used MGSplitView Controller For Add SplitView to NavigationController
    bt i dnt Know how to use MGSplitViewController...when I Added MGSplitViewController To My Application The I can't Use property Of MGSplitViewController ...so,
    PLZ Help Me this is very Important For me...
    Thnks..:

  • [iPhone] Nesting a UINavigationController in a UITabBar

    Some background on my problem:
    I looked through the sample code for SimpleDrillDown, which is basically a tutorial for using the Nav controller with UITableViews. So I made my own project, and basically redid what was in the sample. This works fine for me. Basically I have the app delegate, a RootViewController, and a DetailViewController (which acts as the inspector).
    In the AppDelegate's applicationDidFinishLaunching: method, it does some basic setup. Creates the RootViewController and adds it to the AddDelegate's ivar of UINavigationController. It then sets the window's subview to be the view of navController. That's basically what the sample does, and same with my own.
    Now I'm trying to add a tab bar to my application. I've read the View Controller programming guide, which was pretty straightforward. There is a section for adding NavControllers to a UITabBarController. The instructions read like I expected them too, and seem logical. But I'm having trouble...
    So what I did was this.. left my code the way it was, and added a UITabBarController to my AppDelegate. In the applicationDidFinishLaunching: method, I initialized the tabBarController. In the View Controller Programming guide, it then says to set tabBarController.views property to an NSArray of view controllers (one for each tab of the tabBar). Makes sense. So I made an array containing only the navBarController I previously made. I then set this array to the tabBarController.views property. Then I added the tabBarController.view as the window's subview (instead of the navController's view as before).
    When I run the application, I get a tabBar visible, but it's completely white, and there is only one, blank tabBarItem in the bar at the bottom. I inspected my code with GDB after I set the tabBarController.view property, and it appears it does not set, as the value in the debugger is 0x0.. The rest of the tabBarController has proper values, but the views array doesn't seem to want to set.
    So this is kind of driving me crazy. I hope my explanation made sense (and also wasn't too verbose...heh). If anyone has any ideas please let me know, this is really bugging me!
    Thanks again,
    JB.

    OK. I will try this when I get home, it sounds reasonable.
    I've been looking around more and it appears there is an error in the View Controller Programming guide, in the line where I initialize the tabBarController.
    In the docs it says something like:
    UITabController *tabController = [[UITabController alloc] initWithNibName:nil bundleName:nil];
    The solutions I've read sugguest this is an error and instead should just be:
    UITabController *tabController = [[UITabController alloc] init];
    Again, I will try this out as well when I get home, and report back.
    Thanks!

  • Object allocations, memory and UINavigationController

    I'm having a problem with object allocations
    Is it possible to release/remove a view from a navigation controller stack when I click on the back button on my navigation controller? I wish to get rid of the view I just left (the one disappearing to the right of the screen). The problem is that the next time I navigate to the same view lots of new objects are allocated, and none of the old ones are released.
    In the tableView:didSelectRowAtIndexPath: method I initialize a new view controller for the view I want to push to the stack and assign it to a property. The problem is that the old view seems to continue to exist in the navigation controller stack, because it's never released according to the "object allocation" section in Instruments, thus the amount of allocated objects and memory just grows and grows as I click back and forth in my navigation controller.
    For example, if I click on a cell in the first table view (which displays a second view) and then click on the back button and then click on the first cell again, the second view and all of its objects are created again, but the previous instance of this view seems to still exist somewhere in the navigation controller stack.
    What's the best way to solve this?
    Here's some of the code in the "tableView:didSelectRowAtIndexPath:" method:
    self.categoryController = [[CategoryViewController alloc] init];
    self.categoryController.category = category;
    [self.navigationController pushViewController: self.categoryController animated:YES];
    Each time this code is executed tons of new objects are allocated, but the objects allocated by the previous CategoryViewController are not released.

    Thanks you so much for the great article!!
    cotton.m!!
    I can cheat on my assignment again, haha!
    strange
    Stepwise Refinement :|
    http://forum.java.sun.com//thread.jspa?threadID=5206258

  • [iPhone] Setting UINavigationController children in XIB

    Is there any way to do the equivalent of:
    \[myUINavigationController initWithRootViewController:myViewController\]
    in Interface Builder?
    Message was edited by: Lawrence Wang

    When you have the representation of your Navigation Controller, you have the view that appears in gray surrounded by a dotted rounded rectangle.
    If you click on that, the Inspector shows you the properties of the view.
    In the "Attributes" tab (use cmd + 1 to display) you have two attributes.
    First is the title and the other is drop down list for the nib file name.
    Initially that list is empty, but once you have designed the nib file of your viewcontroller and added it to your project, you'll be able to select it there.
    Hope this helps

Maybe you are looking for

  • Full ipod mini... how do i make it so I can still have all my songs on ...

    how do i make it so that I can have all my songs on itunes, but only have some of them on my ipod? there are those blue boxes with ticks in them, do they have anything to do with it? thanks xx

  • Using variable as table name in pl/sql query - Is possible?

    I am relatively new to PL/SQL and I am trying to create a function that accepts a table name and a rowid as arguments and returns a comma-delimited record string of the values of the table/rowid being passed. The problem is , I cannot code a select s

  • Line separator for text files

    Hello I am writing a tab limited file which gets its data from a string[][] array . When i try opening the file its messed up with square blocks in notepad and looks great with wordpad. I do know that Unix has '\n' as the line separator, whereas wind

  • Trial version ended in one day??? I didn't get the entire 30 day trial period

    I down loaded photo shop elements free 30 day free trial yesterday, and today when I try to open it, it states trial has ended...........I don't understand what happen or why it ended. Please help!

  • What is local storage? Why can't I get this app?

    So I'm trying to get the sims free play app on my ipod4g. It requires 569MB. So I click download and it says I do not have enough local storage. Which I clear do cause I just deleted almost everything off my iPod. I have 1.0GB of free storage left. I