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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:19:49+00:00 2026-05-23T07:19:49+00:00

I have a class, call it Class1 , which contains an array, call it

  • 0

I have a class, call it Class1, which contains an array, call it array1, as a property, and I retain and synthesize it.

I want to add objects to that array with values I get from other views. So for each view, I reference Class1, create an object, and I add the value to array1 and display it for that particular view. This works!

When I go to the new view, I am required to reinitialize array1 to copy the new objects to it (or it gives me an error that array1 is null), but the previous value (the value which was stored in the previous views) is lost. I understand that “retain” is for a specific class, and the array does not retain values for the whole course of the program.

How do I go about this?

  • 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-23T07:19:49+00:00Added an answer on May 23, 2026 at 7:19 am

    You can consider creating a singleton class which you can access anywhere in your application. Apple docs have a standard approach for creating singleton classes. You can make Class1 a singleton class.

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

Sidebar

Related Questions

I have a template class that I serialize (call it C), for which I
I have a class that contains a dynamically allocated array, say class A {
I have a class, let's call it Foo , which contains the 3 following
I have a custom class in Obj-C called RouteManager which contains an array of
I have a small class, let's call uomvalue, which contains a UOM and a
I have created a separate class (let's call it class2.cs for example) and want
I have a base class Node which contains a list of child nodes. Node
I have Packet class contains virtual method and I have LogInRequest class which extends
I have a view which contains a tableview, (i call this view the EquationView,
so i have a class which contains basic stuff like Class Test{ public function

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.