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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:43:57+00:00 2026-05-23T18:43:57+00:00

I know this is very basic but I need clarification. I’m trying to develop

  • 0

I know this is very basic but I need clarification. I’m trying to develop an iPad app but having trouble. My explanation may be a little too much information needed but bear with me.

I have two ViewControllers. One is called NewGameViewController while the other is called GameViewController. In the NewGameViewController I display the GameViewController like so:

GameViewController *controller = [[GameViewController alloc] initWithNibName:@"GameViewController" bundle:nil];
[self.navigationController pushViewController:controller animated:YES];

So this creates an instance of GameViewController in memory. GameViewController has some ivars and methods defined in it. One of the ivars is an array that gets filed with seat objects when GameViewController loads (in the viewWillAppear method).

I also have an object called player. This is just a subclass of UIView. When GameViewController loads it adds up to six player objects to the subview. I need each player object to be able to access the same instance in memory of GameViewController that was loaded by NewGameViewController. Would I use a pointer in my player objects to access the same instance of GameViewController? I’ve found that if I load a new instance of GameViewController into memory and attempt to use it the array ivar tends to be empty and therefore unuseable. How would I be sure that my pointer to GameViewController is pointing to the correct instance of GameViewController?

  • 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-23T18:43:57+00:00Added an answer on May 23, 2026 at 6:43 pm

    When GameViewController loads it adds up to six player objects to the
    subview.

    So, here’s what you can do. Define a property on Player called containingViewController or gameViewController.

    @property (nonatomic, retain) GameViewController *containingViewController;
    

    Don’t forget to also @synthesize containingViewController; in your implementation file (Player.m) and [containingViewController release]; in your dealloc.

    Then, when you initialize the players in the viewWillAppear method, set the property:

    player1.containingViewController = self;
    

    That should take care of all of your issues.

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

Sidebar

Related Questions

I know this maybe a very basic question but I'm having a bit of
I know this is very basic question, but I need to know, how I
guys I know this question is very basic but I've met in few publications
Ok, I know this is a very basic question, but my head is swimming
I know, this might be a very basic question but I am not 100%
I know this is a very broadly scoped question, but what do I need
I know this is very basic but i am frustrated like anything.. i googled
I know this is a very basic question. But I am really not able
This is a very very basic question and I know one way is to
I know this is very evil, but is it possible to add an object

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.