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

  • Home
  • SEARCH
  • 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 7626949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:23:41+00:00 2026-05-31T05:23:41+00:00

I have a UISplitViewController that is set up like so: -(IBAction)makeStory:(id)sender{ NSLog(@makeStory:); makeStoryTableViewController =

  • 0

I have a UISplitViewController that is set up like so:

-(IBAction)makeStory:(id)sender{
NSLog(@"makeStory:");

    makeStoryTableViewController = [[MakeStoryTableViewController alloc] initWithNibName:@"MakeStoryTableViewController" bundle:nil];
    MakeSentenceTableViewController *detailViewController = [[MakeSentenceTableViewController alloc] initWithNibName:@"MakeSentenceTableViewController" bundle:nil];
    UISplitViewController *splitViewController = [[[UISplitViewController alloc] init] autorelease];

    UINavigationController *rootNav = [[[UINavigationController alloc] initWithRootViewController:makeStoryTableViewController]autorelease];

    UINavigationController *detailNav = [[[UINavigationController alloc] initWithRootViewController:detailViewController] autorelease];

    splitViewController.viewControllers = [NSArray arrayWithObjects:rootNav, detailNav, nil];
    splitViewController.delegate        = makeStoryTableViewController;

    StoryBotAppDelegate *appDelegate = (StoryBotAppDelegate *)[[UIApplication sharedApplication] delegate];
    [appDelegate.window setRootViewController:splitViewController];
}

When I try to set detailView in the UISplitView delegate as a result of didSelectRowAtIndexPath:, I can only access the NavigationController:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {   
    NSLog(@"ViewControllers: %@", [self.splitViewController viewControllers]);
    MakeSentenceTableViewController *detailViewController = [[self.splitViewController viewControllers] objectAtIndex:1];
    Story *storySet = [fetchedResultsController objectAtIndexPath:indexPath];
    NSLog(@"detailViewController: %@", detailViewController); //Logs a UINavigationController
    [detailViewController setStory:storySet]; //Fails here because Navigation Controllers Can't setStory!
    [detailViewController refreshTables];
} 

Which makes sense, but how do I access the TableViews that the UINavigationControllers are responsible for? If I remove *rootNav and *detailNav and replace them with the UITableViews in the splitViewController.viewControllers statement it works fine, but then I have no navigation bar:

    MakeSentenceTableViewController *detailViewController = [[MakeSentenceTableViewController alloc] initWithNibName:@"MakeSentenceTableViewController" bundle:nil];
    UISplitViewController *splitViewController = [[[UISplitViewController alloc] init] autorelease];

    //UINavigationController *rootNav = [[[UINavigationController alloc] initWithRootViewController:makeStoryTableViewController]autorelease];

    //UINavigationController *detailNav = [[[UINavigationController alloc] initWithRootViewController:detailViewController] autorelease];

    splitViewController.viewControllers = [NSArray arrayWithObjects:makeStoryTableViewController, detailViewController, nil];
    splitViewController.delegate        = makeStoryTableViewController;

    StoryBotAppDelegate *appDelegate = (StoryBotAppDelegate *)[[UIApplication sharedApplication] delegate];
    [appDelegate.window setRootViewController:splitViewController];

How can I access the Detail TableView Controller and keep the Navigation Bar?

  • 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-05-31T05:23:42+00:00Added an answer on May 31, 2026 at 5:23 am

    Here’s how I figured it out. I made two mistakes, and in those mistakes I had to use the UINavigationController.viewControllers ObjectAtIndex: property.

    1. In the function makeStory I was incorrectly assigning a UINavigationController as a delegate instead of a makeStoryTableViewController. I fixed it by doing this, instead (pay special attention to the splitViewController.delegate section):

      MakeSentenceTableViewController *detailViewController = [[MakeSentenceTableViewController alloc] initWithNibName:@"MakeSentenceTableViewController" bundle:nil]; 
      UISplitViewController *splitViewController = [[[UISplitViewController alloc] init] autorelease];
      
      UINavigationController *rootNav = [[[UINavigationController alloc] initWithRootViewController:makeStoryTableViewController]autorelease];
      
      UINavigationController *detailNav = [[[UINavigationController alloc] initWithRootViewController:detailViewController] autorelease];
      
      splitViewController.viewControllers = [NSArray arrayWithObjects:rootNav, detailNav, nil];
      
      //splitViewController.viewControllers = [NSArray arrayWithObjects:makeStoryTableViewController, detailViewController, nil];
      //RootViewController *root = (RootViewController *)[navigationController.viewControllers objectAtIndex:0]
      
      splitViewController.delegate        = [rootNav.viewControllers objectAtIndex:0];
      
      NSLog(@"delegate: %@",  [rootNav.viewControllers objectAtIndex:0]);
      
      StoryBotAppDelegate *appDelegate = (StoryBotAppDelegate *)[[UIApplication sharedApplication] delegate];
      NSLog(@"RootViewController: %@", appDelegate.window);
      
      [appDelegate.window setRootViewController:splitViewController];
      
      NSLog(@"AppDelegate.window: %@", appDelegate.window.rootViewController);
      
    2. I made the same mistake again, this time in the didSelectRowAtIndexPath: and tried to setStory in a UINavigationController. To fix it, I did this (pay special attention to the bit about navControllerDetail.viewControllers:

      UINavigationController *navControllerDetail;
      navControllerDetail = [[self.splitViewController viewControllers] objectAtIndex:1];
      
      
      
      MakeSentenceTableViewController *detailViewController;
      
      detailViewController = [navControllerDetail.viewControllers objectAtIndex:0];
      
      Story *storySet = [fetchedResultsController objectAtIndexPath:indexPath];
      
      
      
      NSLog(@"detailViewController: %@", detailViewController);
      [detailViewController setStory:storySet];
      [detailViewController refreshTables];
      

    Now if only I could figure out how to get the SplitViewController to rotate properly!

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

Sidebar

Related Questions

I have this button on the leftside of my UISplitViewController (RootViewController) that has a
I have the following setup: A subclass of UISplitViewController that creates the master and
For the app that i am developing i have used a UISplitViewController as my
When using a UISplitViewController in portrait , I have a settings popover that I
I have a UISplitViewController in a xib file that contains two custom UIViewControllers. I
I have UISplitViewController that I want to be updated from a UIViewController that is
I am building a universal app that uses a UISplitViewController for the iPad, and
I have a generic UISplitViewController (UITableView in the RootViewController and other stuff in the
I have a program that creates UIViewControllers in a UISplitView depending upon which row
I am developing for iPad and have created a standard UISplitViewController application using the

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.