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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:46:42+00:00 2026-05-23T01:46:42+00:00

I have a first view which is the log in screen. After the user

  • 0

I have a first view which is the log in screen. After the user logs in there’s a button to push the view to my second view. My problem is that when I press the button which pushes back to the first view, it calls the viewDidLoad method and runs the view as though I just built the app. I have other labels that are set according to the logged in user, so I want to have my state of the first view before it was pushed to be retained.

This is the method I use to push to second view:

-(IBAction) secondView
{
    _secondView = [[SecondViewController alloc]initWithNibName:nil bundle:nil];
    [self presentModalViewController:_secondView animated:YES];
    [_secondView release];
}

and the method to push back to first view:

-(IBAction) back {
    _firstView = [[FirstViewController alloc]initWithNibName:nil bundle:nil];
    [self presentModalViewController:_firstView animated:YES];
    [_firstView release];
}

I’m not using navigation controller, so is there a way to push back to my first view to the way it is when I pushed to my second view? Thanks in advance.

  • 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-23T01:46:43+00:00Added an answer on May 23, 2026 at 1:46 am

    To go back to the firstViewController, instead of pushing it onto the stack (which would then be _firstView _secondView _firstView), pop the secondViewController with

    -(IBAction) back {
        [self dismissModalViewControllerAnimated:YES];
    }
    

    The problem with what you’re doing is that you are creating a new firstViewController when you “go back” using your current method (alloc and init are the clues to this). Really, you just want to pop the secondViewController off of the top of the firstViewController, which you can do with the method above.

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

Sidebar

Related Questions

i have a problem in android, first i wanted to have a button which
I have this code: tableList = [[NSMutableArray alloc] initWithObjects:@First View,@Second View,nil]; I have synthesized
I have a view that is joining two tables and ordering by the first
I have two view controllers that allow changes to the Address Book. The first
I have the following situation: There is one custom view inside of the first
I have First/Last/Previous/Next buttons that change the selected child node of a TreeViewItem. Setting
I have a model that holds user address. This model has to have first_name
I have a django template which extends the base template that has code to
I have a form which renders, but when I click the submit button, I
I have a custom listview which display an image, textview and radio button. I

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.