TechnoBuzz

A Techno Blog, mainly about Java

Beginning iOS

This project i used a storyboard and I added a label and a button to it. I then took the button on the storyboard clicked the control button and held it down into the controller (h file).

This generated code:

@property (weak, nonatomic) IBOutlet UILabel *display;

I then on the storyboard located the button and clicked control button held it down and dragged the link into the controller. This created a method in the controller. I added a print to the method:

#import “RookieViewController.h”

@implementation RookieViewController

@synthesize display;

– (IBAction)buttonDo:(id)sender {

NSLog (@”test”);

}
….

I then modified the above method to change the label on a button click:

– (IBAction)buttonDo:(id)sender {

NSLog (@”test”);

UILabel *label1 = self.display;

NSString *label1text =label1.text;

NSLog(@”the label was %@” ,label1text);

[label1 setText:@”Luke”];

}

RookieAppDelegate.h: define your class as a UI Reponder

@interface RookieAppDelegate : UIResponder

@property (strong, nonatomic) UIWindow *window;

@end

January 27, 2013 Posted by | Uncategorized | | Leave a comment