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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:51:46+00:00 2026-05-31T13:51:46+00:00

My application launches into a navigation controller. The root view controller has a button

  • 0

My application launches into a navigation controller. The root view controller has a button which creates a popover with a tableViewController allowing the user to select a cell which, using a delegate of the TableViewController that is set when the popover is created though ‘preperaForSegue’, communicates back to the root view controller and pushes the relevant ViewController onto the navigation stack.

Delegate set like this:

-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    if ([segue.identifier isEqualToString:@"planningSegue"]) 
    {
        [segue.destinationViewController setDelegate:self];
    }
}

Method called like this:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [[self delegate] gotoPlanningToPage:[tableView cellForRowAtIndexPath:indexPath].textLabel.text];
}

This much works fine.

I have another button on the root view controller which brings up a different popover with a different tableViewController, this one has a list of options each of which, when selected, will segue another table view onto the stack (still within the popover) containing a list of items. Selecting one of these needs to communicate back to the main ViewController (the one which created the popover initially) to push a new view onto its navigation stack similarly to how the first button does.

The question: How/where do I set the delegate for the second tableViewController?

I can’t create it when the popover is created, because the second tableViewController only comes into existence when a cell is selected in the first TVC. But I can’t work out how to set it from the first TVC when the second TVC is being called because I don’t see a way to be able to communicate back to the creator (parent?) of the popover.

The only thought I’ve had is to set the main ViewController to be a delegate for the first level TVC in the popover, then setting that TVC to be a delegate to the second level TVC and passing a message back through one, to the other… That just doesn’t sit right though, I can’t help but thing that there must be a simpler/cleaner way to do it rather than creating a delegate with the sole purpose of helping something else set its delegate!

I’m still relatively new to all this, so apologies if I haven’t made sense or if I’ve missed something glaringly obvious!

  • 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-31T13:51:48+00:00Added an answer on May 31, 2026 at 1:51 pm

    Whether or not this is the best way, I’m not sure, but it seems to be working and setting the delegate just fine. I’ve put the following in prepareForSegue in the popovers first tableViewController,

    -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(UITableViewCell *)sender
    {
        SecondLevelTVC *secondLevelTVC = (SecondLevelTVC *)segue.destinationViewController;
        UINavigationController *mainNav = (UINavigationController *)self.view.window.rootViewController;
        RootAppViewController *rootAppViewController = (RootAppViewController *)mainNav.topViewController;
        secondLevelTVC.delegate = rootAppViewController;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java application that launches another java application. The launcher has a
It seems like a standard requirement: next time the user launches the application, open
I have activity A, which launches activity B via an intent. Activity A has
I have a C# application which launches another executable using Process.Start() . 99% of
I have an application that launches a webpage in the current browser when the
I have a MFC application that launches a IWebBrowser2 window. On users computers where
Okay so I want to make an application that launches other applications. However, the
I have an application running only on Windows and a batch file that launches
I have a UITableView with two sections, which are both empty when my application
I have some query. First of all let's have an iPhone application flow which

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.