title: Objective C: How to Write a Instantiating Custom Init
body: <p>Very basic question, but I have an error in my code that can only be answered by one assumption: my class isn't being instantiated!</p>
  
  <p>I haven't written much in Objective C in some time, and I was never really good, so please point out even the most painfully obvious.</p>
  
  <p>I am using:</p>
  
  <pre><code>ObjectSelectionViewController *length = [[ObjectSelectionViewController alloc] initWithMeasureType:0];
  ObjectSelectionViewController *mass = [[ObjectSelectionViewController alloc] initWithMeasureType:1];
  ObjectSelectionViewController *volume = [[ObjectSelectionViewController alloc] initWithMeasureType:2];
  
  NSLog(@"%@", [length measurementType]);
  NSLog(@"%@", [mass measurementType]);
  NSLog(@"%@", [volume measurementType]);
  </code></pre>
  
  <p>The NSLogs return whichever measurement was assigned last, regardless of the separate allocs and inits.</p>
  
  <p>Here is the constructor of the ObjectSelectionViewController class:</p>
  
  <pre><code>#import "ObjectSelectionViewController.h"
  
  @implementation ObjectSelectionViewController
  
  NSString *measurementType;
  
  -(ObjectSelectionViewController*) initWithMeasureType:(int)value
  {
  switch (value) {
      case 0: // Length
          measureType = @"Length";
          break;
  
      case 1: // Mass
          measureType = @"Mass";
          break;
  
      case 2: // Volume
          measureType = @"Volume";
          break;
  }
  return self;
  }
  
  -(NSString*) measurementType
  {
  return measureType;
  }
  </code></pre>
  
  <p>Thanks for the help, it's driving me crazy!</p>