title: Working with NSMutableString (Beginner)
body: <p>I'm working with a NSMutableString and having some difficulties. The app quits whenever i try to access it and it does not say that anything is amiss in the NSLog. </p>
  
  <p>I set up the string in the view did load method so that my string will be able to retain its information rather than being reset, but i don't believe my knowledge on this is correct. Any help would be great. Thanks!</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @class rootViewController;
  
  @interface Numpad : UIViewController {
  
      rootViewController *viewController;
  
      UIButton *one;
      UIButton *two;
      UIButton *three;
  
      NSInteger *loggedNumbers;
      NSMutableString *numberString;
  }
  
  -(IBAction)buttonClicked:(id)sender;
  
  
  @property (nonatomic, retain)IBOutlet UIButton *one;
  @property (nonatomic, retain)IBOutlet UIButton *two;
  @property (nonatomic, retain)IBOutlet UIButton *three;
  
  @property (nonatomic, retain) rootViewController *viewController;
  
  
  @end
  </code></pre>
  
  <p>and the .m</p>
  
  <pre><code>#import "Numpad.h"
  
  
  @implementation Numpad
  
  @synthesize viewController, one, two, three, four, five, six, seven, eight, nine, zero;
  
  - (void)initString{
  
  }
  
  - (IBAction)buttonClicked:(id)sender{
  
  
      int stringLength = [numberString length];
  
      //NSLog(@"Number String before Switch: %@", numberString);  
  
      switch (((UIButton*)sender).tag){
  
          case 1:
              {
                  [numberString insertString: @"1" atIndex: stringLength];
              }
          break;
  
          case 2:
              {
                  [numberString insertString: @"2" atIndex: stringLength];
              }
              break;
  
          case 3:
              {
                  [numberString insertString: @"3" atIndex: stringLength];
              }
              break;
  
          default:
          break;
      }
  
  
      double myDouble = [numberString doubleValue];
      int myInt = (int)(myDouble + (myDouble&gt;0 ? 0.5 : -0.5));
  
      NSLog(@"Number String: %@", numberString);  
      NSLog(@"After int applied: %i", myInt);
  }
  
  
  
  
  /*
   // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
  - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
      if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
          // Custom initialization
      }
      return self;
  }
  */
  
  
  // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
  - (void)viewDidLoad {   
      numberString = [[NSMutableString stringWithString: @""];
      [super viewDidLoad];
  }
  </code></pre>