title: How to init objects in Objective-C
body: <p>I'm unsure how I should initialise the various properties in an objective-C class. Please assume I'm a very new user to Objective-C in your answers...</p>
  
  <p>I have the following classes:</p>
  
  <p>Test class</p>
  
  <pre><code>@interface Test : NSObject
  @property (nonatomic, strong) NSString *name;
  @end
  </code></pre>
  
  <p>TestManager class</p>
  
  <pre><code>@interface TestManager : NSObject
  @property (nonatomic, strong) NSMutableArray *tests; // array of Test objects (array size unknown until runtime)
  @end
  </code></pre>
  
  <p>Controller class</p>
  
  <pre><code>@interface TestController : NSObject
  @property (nonatomic, strong) TestManager *aManager;
  -(void)initManager;
  -(void)doSomething;
  @end
  </code></pre>
  
  <p>I want to have an method like <code>initManager</code> called:</p>
  
  <pre><code>-(void)initManager
  {
      // how can I init the aManager which will have an array of Test objects
  }
  </code></pre>
  
  <p>which will automatically allocate an array of objects to be stored inside the manager class so I can do things like:</p>
  
  <pre><code>-(void)doSomething
  {
     NSString *name = ((Test *)[self.aManager.tests objectAtIndex:0]).name;
  }
  </code></pre>
  
  <p>I'm not even sure that initManager is the correct method to use - is there something built in that always gets called?</p>