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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:25:50+00:00 2026-05-20T07:25:50+00:00

How do I retain the values after switching to another view and returning back

  • 0

How do I retain the values after switching to another view and returning back to the same view?

Is there a way to retain the array even after the view disappears?

My Array shows the values in console first time, but second time when it returns from other view the array shows (null)

EDIT:

I am using this array to use it into my core-plot.

This array contains the plot points for the core-plot

  • 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-20T07:25:51+00:00Added an answer on May 20, 2026 at 7:25 am

    Generally speaking you have a few options to maintain data persistence between views. In no particular order:

    1. Pass the array back and forth between the views. This involves creating a property on each view and setting it. You can use properties directly but you might have an easier time using NSNotifications to pass the data around.

    2. Store the data in Core Data, loading lazily as needed. This is the most powerful option and may be a bit much. Core Data is not the correct way to “pass data between views”, but often may be what you need. As an added bonus, your data stays saved across app launches.

    3. Store the data in your delegate. This is similar to using NSNotofications. All of your objects can access the delegate more easily than passing references to each other all over the place.

    4. Store the array in NSUserDefaults, assuming your data is compatible. This is similar to Core Data in that it offers persistence, but is much more “lightweight” and less powerful. Note that some objects are incompatible with NSUserDefaults.

    Edit:

    For storing an array of points, I would serialize it into either Core Data or NSUserDefaults, depending on how the user interacts with the data and how much data there actually is. If the points change often and there are many of them, look into Core Data. Although, you can do just fine with an array in NSUserDefaults. You just end up doing more array manipulation.

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

Sidebar

Related Questions

Is there a way to retain values of textfield/textbox when a user submits a
I am trying to find what the easiest way to keep form values after
I have one array. I want that array to retain its value between function
Just curious if there is anyway to display an objects retain count using NSLog.
I've got a dictionary initialized like so... keyDictionary = [[NSDictionary dictionaryWithObjects:values forKeys:keys]retain]; where keys
After the user is done with form f, the form will retain a value
I have two UIPickerViews set up on one view under the same view controller.
I have looked at this question first: retain value after page refresh . But
Executing this code: mainLyr = [[CALayer layer] retain]; [mainLyr setFrame:CGRectMake(0.0,0.0,23.0,23.0)]; in debugger, I found
Summary of my question: Does NSURLConnection retain its delegate? Detailed question and scenario: 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.