Note that there are some explanatory texts on larger screens.

plurals
  1. POPassing an array from NSObject to a View Controller
    text
    copied!<p>Im fairly new to Objective-C. I am in the process of passing an array from an NSObject to a view controller (not my root). The NS object file, finishes with the array poolArray. Ive also used <code>self.poolArray = nil;</code> in void(dealloc). When passing this to my view controller, what are the steps I have to take? </p> <p><strong>Edit:</strong> To be more specific to my cause, what if I was just to deal with two view controllers?</p> <pre><code>-(void)createData { //poolFixtures being the text within each cell of my table view. NSMutableArray *poolFixtures; groupSections=[[NSMutableArray alloc] initWithObjects: @"Pool Stages", nil] poolFixtures=[[NSMutableArray alloc] init]; [poolFixtures addObject:[[NSMutableDictionary alloc] initWithObjectsAndKeys:@"This is a name",@"name",nil]]; fixtureData=[[NSMutableArray alloc] initWithObjects: poolFixtures, nil]; [poolFixtures release]; } </code></pre> <p>I have a similar set up for my second view controller. However, the titles needed for the second one require me to download data from a html file, parse them into the format i want etc. When used in the second view controller it takes a long time (I presume because of the html loading time). What I am trying to accomplish (what I thought i could do with an NSobject), is starting the data collection as soon as the user opens the app; so, by the time the user gets to the second view controller, it is loaded and ready. </p> <p>Therefore I am wondering if I could do the downloading, and parsing in the root view controller, and send the array across to the second view controller for use when needed. I thought I would be able to use the createData part of my root implementation to do so.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload