title: How to call a method from another class with a simple button in Xcode
body: <p>I'm trying to call a method from another class with a simple button in my storyboard.
  Here are my files:</p>
  
  <p>ViewController.m</p>
  
  <pre><code>//  ViewController.h
  
  
  #import &lt;UIKit/UIKit.h&gt;
  #import &lt;Foundation/Foundation.h&gt;
  #import "PrintHello.h"
  
  @interface ViewController : UIViewController &lt;NSObject&gt;{
  
  PrintHello *printMessage;
  }
  
  @property (nonatomic, retain) PrintHello *printMessage;
  @end
  </code></pre>
  
  <p>ViewController.m</p>
  
  <pre><code>//  ViewController.m
  #import "ViewController.h"
  @interface ViewController ()
  @end
  
  @implementation ViewController
  @synthesize printMessage;
  
  
  - (void)viewDidLoad{
  [super viewDidLoad];
  NSLog(@"ViewDidLoad loaded");
  }
  
  
  - (IBAction)Button01:(id)sender{
  
  self.printMessage = [[PrintHello alloc] init]; // EDIT: THIS LINE WAS MISSING NOW IT WORKS
  
  [self.printMessage Print];
  NSLog(@"Button01 Pressed");    
  }
  @end
  </code></pre>
  
  <p>PrintHello.h</p>
  
  <pre><code>//  PrintHello.h
  #import &lt;Foundation/Foundation.h&gt;
  
  @interface PrintHello : NSObject
  -(void) Print;
  @end
  </code></pre>
  
  <p>PrintHello.m</p>
  
  <p>//  PrintHello.m</p>
  
  <pre><code>#import "PrintHello.h"
  @implementation PrintHello 
  
  -(void)Print{ NSLog(@"Printed");}
  
  @end
  </code></pre>
  
  <p>And also in the storyBoard there is a Button01 linked to the Viecontroller.
  From the Log i know that:</p>
  
  <p>viewDidLoad is loaded
  and the button is pressed when is pressed :)
  BUT the method Print is not called?</p>
  
  <p>Where am i doing wrong?</p>