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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:37:54+00:00 2026-06-09T03:37:54+00:00

I am writing a simple application that has 3 view controllers. The root view

  • 0

I am writing a simple application that has 3 view controllers. The root view controller is an item listing, basic table view. Off of this view controller, I push two different view controllers based on some user interaction – a create item view controller or a view item view controller.

So, the storyboard segues just look like a V, or something.

On my create item view controller, I would like it to pop back to the root view controller when the user creates a new item, but then push to the view item controller so that I can look at the newly created item.

I can’t seem to get this to work. It’s easy enough to pop back to the root view controller, but I’m unable to push that view item controller.

Any ideas? I’ve pasted my code, below. The pop function works, but the new view never appears.

- (void) onSave:(id)sender {

    CLLocation *currentLocation = [[LocationHelper sharedInstance] currentLocation];

    // format the thread object dictionary
    NSArray* location = @[ @(currentLocation.coordinate.latitude), @(currentLocation.coordinate.longitude) ];
    NSDictionary* thread = @{ @"title": _titleField.text, @"text": _textField.text, @"author": @"mustached-bear", @"location": location };

    // send the new thread to the api server
    [[DerpHipsterAPIClient sharedClient] postPath:@"/api/thread"
                                       parameters:thread
                                          success:^(AFHTTPRequestOperation *operation, id responseObject) {

                                              // init thread object
                                              Thread *thread = [[Thread alloc] initWithDictionary:responseObject];

                                              // init view thread controller
                                              ThreadViewController *viewThreadController = [[ThreadViewController alloc] init];
                                              viewThreadController.thread = thread;

                                              [self.navigationController popToRootViewControllerAnimated:NO];
                                              [self.navigationController pushViewController:viewThreadController animated:YES];

                                          }
                                          failure:^(AFHTTPRequestOperation *operation, NSError *error) {

                                              [self.navigationController popToRootViewControllerAnimated:YES];

                                          }];

}
  • 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-09T03:37:55+00:00Added an answer on June 9, 2026 at 3:37 am

    An easy way to accomplish what you want to do is to build some simple logic into your main root view controllers -(void)viewWillAppear method and use a delegate callback to flip the logic switch. basically a “back reference” to the root controller. here is a quick example.

    main root controller (consider this controller a) – well call it controllerA
    set a property to keep track of the jump status

    @property (nonatomic) BOOL jumpNeeded;
    

    setup some logic in

    - (void)viewWillAppear:(BOOL)animated {
        [super viewWillAppear:animated];
        self.jumpNeeded ? NSLog(@"jump needed") : NSLog(@"no jump needed");
    
        if (self.jumpNeeded) {
            NSLog(@"jumping");
            self.jumpNeeded = NO;
            [self performSegueWithIdentifier:@"controllerC" sender:self];
        }   
    }
    

    Now, in your main root controller,when a tableview row is selected do something like this
    when pushing to controllerB in your tableView did select method

    [self performSegueWithIdentifer@"controllerB" sender:self];
    

    then implement your prepare for segue method

    - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    
      //setup controller B
      if([segue.identifier isEqualTo:@"controllerB"]){
        ControllerB *b = segue.destinationViewController;
        b.delegate = self;  //note this is the back reference
      }
    
      //implement controller c here if needed
    }
    

    Now move on to controllerB
    you need to set a property called “delegate” to hold the back reference
    and you need to import the header file from the root controller

    #import "controllerA"
    
    @property (nonatomic,weak) controllerA *delegate;
    

    then just before you pop back to controllerA, you set the flag

       self.delegate.jumpNeeded = YES;
        [self.navigationController popViewControllerAnimated:YES];
    

    and that is about it. You don’t have to do anything with controllerC. There are a few other ways to do, but this is pretty straight forward for your needs. hope it works out for you.

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

Sidebar

Related Questions

I'm planning on writing a simple application in Java which has a basic UI
I'm new to JavaFX and I'm writing a simple login application that I would
I am writing a Facebook application that is a simple board game which I
So I'm writing a Java application that uses Simple to store data as xml
I'm writing a small application in C that reads a simple text file and
I am looking for a basic Django application that looks good and has basic
I am writing a simple application that utilizes option(radio) buttons in vb6. I am
I am writing a WPF application that has an optional dependency on an API
I am writing a simple application that uses Threads to increase the performance. The
I am writing a simple console application in LInux/C++ that accepts user input from

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.