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 7969695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:16:39+00:00 2026-06-04T07:16:39+00:00

I have a splitViewController that has a master and detail view controllers. The code

  • 0

I have a splitViewController that has a master and detail view controllers. The code below is from the master and it creates the new view in the detail:

UIViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:[NSString stringWithFormat:@"%@",[self.defaultSettingsMenuItems objectAtIndex:indexPath.row]]];

[self.detailViewController.view addSubview:controller.view];

detailViewController is a global instance of DetailViewController. In the detailViewController, I have many textFields and need to utilize the UITExtFieldDelegate. However, I think that the detailViewController isn’t self at that point, and that’s why I’m getting EXC_BAD_ACCESS errors on using the TextFieldDelegate methods in detailViewController.

EDIT: I have now found that the subView delegate methods only work for the viewController I setup as the rootViewCOntroller relationship from within Storyboard. Ex. If I have 6 views in the default menu settings above, whichever one I have setup as the first and root view in storyboard will work correctly. Any and all other subviews shown (from making a new selection in the master view) will not work properly. I think this will help diagnose the problem.

  • 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-04T07:16:40+00:00Added an answer on June 4, 2026 at 7:16 am

    This all I needed, the second line:

    UIViewController *viewController= [self.detailViewController.storyboard instantiateViewControllerWithIdentifier:[NSString stringWithFormat:@"%@",[self.defaultSettingsMenuItems objectAtIndex:indexPath.row]]];
    
    if (self.detailViewController.childViewControllers.count >= 1) {
        NSLog(@"childViewControllers: %@",self.detailViewController.childViewControllers);
        [[self.detailViewController.childViewControllers objectAtIndex:0] removeFromParentViewController]; 
    
    }
    
    [self.detailViewController addChildViewController:viewController];
    
    [self.detailViewController.view addSubview:viewController.view];
    

    EDIT: I’ve updated my answer with the if look to remove viewControllers from the stack. Slightly hacky, but functional.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SplitViewController which has two UITableViewControllers - one master/root one detail. Everything
I have a split view-based app that presents a master-detail interface, and uses a
I'm presently trying to switch view from a UIViewController to a SplitViewController. I'm currently
i have app with splitviewcontroller , in master view of splitview i have uitableview
I have UISplitViewController that I want to be updated from a UIViewController that is
I have a SplitViewController (iPad) and its leftViewController is a class inherited from UITableViewController;
This is my first iPad/Storyboard/SplitViewController and it has a table as the master and
I'm writing my own SplitViewController from scratch (i.e. by subclassing UIViewController and not UISplitViewController
I have an application that starts with a Login screen (UIViewController) and then once
We are creating an iPad application that uses multiple SplitViewController. From the Apple documentation

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.