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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:51:18+00:00 2026-05-27T09:51:18+00:00

I hope an easy question (but I can’t solve it :)) I have 2

  • 0

I hope an easy question (but I can’t solve it :)) I have 2 views, On view 1 I have UILabels that I change the text on with a button click, if I navigate to view 2 and then go back to view 1 the text is reset.

Is there any way to retain the text on the label when the view is changed?

Originally I used:

-(IBAction) napButton: 
(id) sender{ nap *nap1 = [[nap alloc] initWithNibName:nil bundle:nil]; 
[self presentModalViewController:nap1 animated:YES]; 

this performed a simple view switch. With the suggestion below I changed this to:

-(IBAction) napButton: 
(id) sender{ nap *nap1 = [[nap alloc] initWithNibName:@"nap" bundle:nil]; 
[self.navigationController pushViewController:nap1]; 
[nap1 release]; } } 

The button performs no action and I get warning UINavigationController may not respond to -pushViewController

  • 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-27T09:51:19+00:00Added an answer on May 27, 2026 at 9:51 am

    use UINavigationController. In a memory constrained device this is the best way to push or pop new views while preserving data or state in previous view.

    An instance of UINavigationController can be created either in code or in an XIB file with relative ease. It’s thought of as a stack: it has a root view controller, and then new view controllers can be pushed onto the stack (often when the user taps on a row in a table) or popped off the stack (often by pressing the back button).

    There are 4our methods are used to navigate user through the stack:

    – pushViewController:animated:
    – popViewControllerAnimated:
    – popToRootViewControllerAnimated:
    – popToViewController:animated:
    

    For example if you want to move from view1 to view2, you need to do this from view1 –

    SecondViewController *secondView = [[SecondViewController alloc]
            initWithNibName:@"SecondViewController" bundle:nil];
        [self.navigationController pushViewController:secondView];
        [secondView release];
    

    to move back to the previous state, i.e. from view2 to view1, you need to do this from view2 –

    [self.navigationController popViewControllerAnimated:YES];
    

    This should solve your problem in the most efficient way.

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

Sidebar

Related Questions

I'm pretty new to android development, so I hope my question is easy, but
I have a problem that I hope you can help/guide me. I saw a
A question has many answers. It is easy to find all questions that have
Hope someone has an easy answer on this. I have a header image which
I hope this is a relatively easy problem although I have spent hours websearching
hope someone can help. I have two tables: Users -UserID -UserName UsersType -UserTypeID -UserID
This feels like a too easy question to be found with google, I think/hope
I'm a newbie with PHP so this might be ridiculously easy question, but despite
I am pretty new to rails so this may be an easy question, but
I have a question similar to the Can you override a parent UIView's alpha

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.