Note that there are some explanatory texts on larger screens.

plurals
  1. POWhere would I implement this array to pass?
    primarykey
    data
    text
    <p>I currently build an <code>NSMutableArray</code> in <strong>Class A.m</strong> within the <code>ViewDidLoad</code> Method.</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; //Question Array Setup and Alloc stratToolsDict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:countButton,@"count",camerButton,@"camera",videoButton,@"video",textButton,@"text",probeButton,@"probe", nil]; stratTools = [[NSMutableArray alloc] initWithObjects:@"Tools",stratToolsDict, nil]; stratObjectsDict = [[NSMutableDictionary alloc]initWithObjectsAndKeys:stratTools,@"Strat1",stratTools,@"Strat2",stratTools,@"Strat3",stratTools,@"Strat4", nil]; stratObjects = [[NSMutableArray alloc]initWithObjects:@"Strategies:",stratObjectsDict,nil]; QuestionDict = [[NSMutableDictionary alloc]initWithObjectsAndKeys:stratObjects,@"Question 1?",stratObjects,@"Question 2?",stratObjects,@"Question 3?",stratObjects,@"Question 4?",stratObjects,@"Question 5?", nil]; //add strategys to questions QuestionsList = [[NSMutableArray alloc]init]; for (int i = 0; i &lt; 1; i++) { [QuestionsList addObject:QuestionDict]; } NSLog(@"Object: %@",QuestionsList); </code></pre> <p>At the end of this method you will see QuestionsList being initialized and now I need to send this <code>Array</code> to <strong>Class B</strong>.</p> <p>So I place its <code>setters</code> and <code>getters</code> using the <code>@property</code> and <code>@Synthesize</code> method. <strong>Class A.h</strong></p> <pre><code>@property (retain, nonatomic) NSMutableDictionary *stratToolsDict; @property (retain, nonatomic) NSMutableArray *stratTools; @property (retain, nonatomic) NSMutableArray *stratObjects; @property (retain, nonatomic) NSMutableDictionary *QuestionDict; @property (retain, nonatomic) NSMutableArray *QuestionsList; </code></pre> <p><strong>Class A.m</strong></p> <pre><code>@synthesize QuestionDict; @synthesize stratToolsDict; @synthesize stratObjects; @synthesize stratTools; @synthesize QuestionsList; </code></pre> <p>I use the property method because I am going to call this variable from <strong>Class B</strong> and want to be able to assign it to another <code>NSMutableArray</code>.</p> <p>I then add the <code>@property</code> and <code>@class</code> for <strong>Class A</strong> to <strong>Class B.h</strong> as well as declare the <code>NSMutableArray</code> in the @interface.</p> <pre><code>#import "Class A.h" @class Class A; @interface Class B : UITableViewController&lt;UITableViewDataSource, UITableViewDelegate&gt;{ NSMutableArray *QuestionList; Class A *arrayQuestions; } @property Class A *arrayQuestions; </code></pre> <p>Then I call <code>NSMutableArray</code> from Class A in the Class B.m</p> <pre><code>-(id)initWithStyle:(UITableViewStyle)style { if ([super initWithStyle:style] != nil) { //Make array arrayQuestions = [[Class A alloc]init]; QuestionList = arrayQuestions.QuestionsList; </code></pre> <p>Right after this I Log the <code>NSMutableArray</code> to view values and check that they are there and it returns <code>NIL</code>.</p> <pre><code>//Log test NSLog(@"QuestionList init method: %@",QuestionList); </code></pre> <p>Info about <strong>Class B</strong>- <strong>Class B</strong> is a <code>UIPopOverController</code> for <strong>Class A</strong>, <strong>Class B</strong> has one View which holds a <code>UITableView</code> which I have to populate the results of <strong>Class A's</strong> <code>NSMutableArray</code>.</p> <p>Why is the <code>NsMutableArray</code> coming back as <code>NIL</code>? Ultimately would like some help figuring it out as well, it seems to really have me confused. Help is greatly appreciated!!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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