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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:13:58+00:00 2026-05-21T16:13:58+00:00

I have a list of items in one view controller. I can select an

  • 0

I have a list of items in one view controller. I can select an item and a detail view controller is pushed to show details of the selected item. I can then select the edit button (from the nav bar) and an edit view controller is pushed to allow me to edit the details of the item. All of this is working, including cancel and undo.

In the first list view controller, I also have an add button (in the nav bar), where I can add a new record. (This is using core data, but I don’t think that has relevance to my question.) I started testing by creating a blank record for the item, and when the detail view controller appears, all of the fields are blank. Then I can select the edit button and edit the details, just as if it were an already populated record. This also works.

What I have been trying to do is select the add button and push the detail view controller and then the edit view controller immediately. The reason I want to do this is so that when I pop the edit view controller, the detail view controller will show. (Then I can pop back to the list view controller or push into the edit view controller again.)

I am having trouble with this.

I tried two pushes in the list view controller, like this:

- (void) add {
    clientInfoTVC.clientMO = [self createNewClient];
    [self.navigationController pushViewController:clientInfoTVC animated:YES]; 
    [self.navigationController pushViewController:clientInfoTVC.clientEditTVC animated:YES]; 
}

where clientInfoTVC.clientEditTVC points to the eidt view controller. This errors SIGABRT and halts when I try an add.

I then tried setting a flag property value in the detail view controller when add is selected, before the first push and then doing a second push in viewWillAppear of the detail view controller. This errors out. I tried moving the second push to the viewDidAppear of the detail view controller, with the same results.

I am lost on this one. Can someone give me some ideas how to push through one view controller to the second one, so that I can maintain the navigation stack and pop back to the middle view controller?


@ljkyser hit on part of the answer. But I also found that simply pushing a view onto the stack does not get it to execute its init, viewWillAppear, and viewDidLoad. I am guessing that since all of this is happening on the main thread, then pushing a view just queues that view controller onto the run loop. Pushing a second view controller removes the first from the run loop and puts the second view controller in the run loop queue. Maybe someone can verify that and describe it more accurately than I just did.

In any case, to get the edit view controller initialized properly, I had to pass a pointer to it, so it can find the managed object it is working with. I had originally instantiated the edit view controller from within the detail view controller. Therefore, in my original code, I was pushing a view controller that was not instantiated yet. To be safe, I instantiated it from the list view controller, and then made sure all of the managed object pointers were set up before I did the double push, like this:

- (void) add {    
    Client *clientNew = [[NSEntityDescription alloc]  init];
    clientNew = [self createNewClient];
    clientInfoTVC.clientMO = clientNew;
    clientEditTVC.clientMO = clientNew;
    [clientNew release];
    [self.navigationController pushViewController:clientInfoTVC animated:NO]; 
    [self.navigationController pushViewController:clientEditTVC animated:YES]; 
}

Confirming the answer given by @ljkyser, I tried these changes while keeping the first animated:YES. With this, the nav bar looked right, but the rest of the view was out of sync. Setting animated:NO fixed that 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-05-21T16:13:59+00:00Added an answer on May 21, 2026 at 4:13 pm

    Try changing your code to this:

    - (void) add {
        clientInfoTVC.clientMO = [self createNewClient];
        [self.navigationController pushViewController:clientInfoTVC animated:NO]; 
        [self.navigationController pushViewController:clientInfoTVC.clientEditTVC animated:YES];
    }
    

    Setting the first pushViewController animated parameter to NO.

    Similar to this SO question: Problem pushing multiple view controllers onto navigation controller stack

    There are other options as well. You can push and pop to specific view controllers if desired (UINavigationController reference) or edit the UINavigationController stack directly (see here).

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

Sidebar

Related Questions

I have a list view control which at the moment only allows one item
I have created one list view.. it is having 5 items... Now I want
If I have two objects, one being the list of items, and the other
I have a list of items that I am displaying in a floated list,
I have a list of items (blue nodes below) which are categorized by the
I have a list of items John ID Matt ID John ID Scott ID
I have a list of items in a hierarchy, and I'm attempting to parse
If I have a list of items, say apples pairs pomegranites and I want
On my rails app I have a list of items (like a task list)
What would be the best way to have a list of items with a

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.