Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8931177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:03:15+00:00 2026-06-15T09:03:15+00:00

i have a navigation controller which is my application’s root view controller. it is

  • 0

i have a navigation controller which is my application’s root view controller. it is my main screen. I have a split view controller whose master view lists location and detail view shows the location on the map. I wanted to push the split view controller to the navigation controller, but it throw a error saying split view controller cant be pushed to navigation controller and it must be application’s root view controller.
So i tried a hard way.

MyAppDelegate *myappdelegate= [[UIApplication sharedApplication] delegate];
UISplitViewController * vc= [[UISplitViewController alloc] init];
vs.viewControllers = [NSArray arraywithObjects......
....
myappdelegate.window.rootViewController= vc;

This works. It shows split view controllers without animation as expected. And i do the same steps when i was closing split view controller. i am creating a navigation controller with main screen nib and setting this my app delegate’s window.rootviewController again.
And it succesfully loads main screen again.

But i suspect that this is the proper way of achieving this. Is there more eligible way of doing this?

And i couldnt release split view controller’s child controllers. i made a breakpoint on my release method of child controllers. it wasnt be catched. I assumed that when i set my app’s root view controller as navigation controller, the old root view controller (split view controller) must be released along with its childs.
Then i tried below code when closing split view controller.

UISplitViewController *oldviewcontroller= (UISplitViewController*) myappdelegate.window.rootViewController;
for (UIViewController *child in oldviewcontroller.viewControllers)
{
     [child release];
}

//Setting the navigation controller as window.rootviewController again in here.

This code throw an error saying “[UIImageView __viewDidDisappear:]: unrecognized selector sent to instance 0x7d….”

i think because of releasing the view already, there is no imageview on viewdidDisappear event.

In brief, my question is that am i using right method to achieve this? If so, how can i successfully release all child view controllers?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:03:16+00:00Added an answer on June 15, 2026 at 9:03 am

    I finally found a way. I probably found the error. What i have done is cutting the branch on which i am sitting. I was releasing the view controller which i am currently in:) When viewdidDisappear called, there is no such view controller. Because i throw away it to space already.Below is my working steps. I hope it will be useful to someone. But i cant stand thinking of apple may reject my app. I wish finding a suitable way.

    This is my working ultimate way of using split view controller and navigation controller as window root view controller alternately.

    Firstly i defined NavigationController and SplitViewController property in AppDelegate interface.

    AppDelegate.h
    @property (assign,nonatomic) UINavigationController * NC;
    @property (assign,nonatomic) UISplitViewController *SVC;
    

    Secondly i assign newly created NC on AppDelegate didFinishLaunch event.

    AppDelegate.m
    //Creating my main screen controller
    //Creating my navigation controller with my view controller instance. Then
    self.NC= my_navigation_controller;
    self.window.rootViewController= self.NC;
    

    Thirdly creating a splitview controller and setting as app’s root view controller

     MyMainScreen.m
     -(void) OpenSplit()
     {
          //Creating my master view controller of SVC
          //Creating my detail view controller of SVC
          //Creating my SVC;
          AppDelegate * app_delegate= [[UIApplication sharedApplication] delegate];
          app_delegate.SVC= newly created my SVC;
          app_delegate.window.rootViewController= app_delegate.SVC;          
     }
    

    Fourthly releasing unused NC in viewDidLoad event of detail view of SVC.

    MyDetailView.m
    - (void) viewDidLoad()
    {
        ...
        AppDelegate * app_delegate= [[UIApplication sharedApplication] delegate];
        app_delegate.NC= nil;  //i dont need it now. i am releasing. Releasing Navigation Controller release as well child controllers. I learned with testing.
    }   
    

    Fifthly managing close split view function.I used UIBarButton on NavigationBar in DetailView.

    MyDetailView.m
    -(void) closeSplitView
    {
         //Creating navigation controller with my main screen view controller
         AppDelegate * app_delegate= [[UIApplication sharedApplication] delegate];
         app_delegate.NC= newly_created_NC;
         app_delegate.window.rootViewController= appdelegate.NC;
    } 
    

    Sixthly handling unused split view controller in Main Screen viewDidLoad event.

     MyMainScreen.m
     -(void) viewDidLoad
     {
        AppDelegate * app_delegate= [[UIApplication sharedApplication] delegate];
        app_delegate.SVC= nil; //I am releasing it because i am working with NC now.
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a core data application which uses a navigation controller to drill down
I have a navigation controller which also has a table view. I want to
In my IB I have a navigation controller which has in it a view
hii... I am making a view based application in which I have tabbar controller
I have a navigation based application which also needs to have a view always
I have Navigation controller as intial view which goes into view controller now i
My application launches into a navigation controller. The root view controller has a button
I have an application which uses a main story board to include a Navigation
Hey. I have a Navigation-controller-based application with a number of Viewcontrollers in it which
I have a tab bar along with navigation controller iphone application. Now I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.