olamundo1_brum_screen-capture

Neste tutorial acontece a introdução a programação para iPhone, as duas simples aplicações mostram o texto “Ola Mundo!” porém de duas maneiras diferentes, a primeira é feita sem nenhuma linha de cógido aparente, apenas pelo interface builder, a segunda ao contrario, usando apenas códigos

Classes:

“ola_mundo_codigoAppDelegate.h”

#import <UIKit/UIKit.h>

@interface Ola_mundo_codigoAppDelegate : NSObject <UIApplicationDelegate> {

UIWindow *window;

}

@property (nonatomic, retain) IBOutlet UIWindow *window;

@end

“ola_mundo_codigoAppDelegate.m”

@implementation Ola_mundo_codigoAppDelegate

@synthesize window;

- (void)applicationDidFinishLaunching:(UIApplication *)application {

[window setBackgroundColor:[UIColor redColor]];

CGRect textFieldFrame = CGRectMake(50, 50, 150,40);

UILabel *label = [[UILabel alloc] initWithFrame:textFieldFrame];

label.textColor = [UIColor whiteColor];

label.backgroundColor = [UIColor redColor];

label.shadowColor = [UIColor blackColor];

label.font = [UIFont systemFontOfSize:24];

label.text = @”Ola mundo!”;

[window addSubview:label];

[window makeKeyAndVisible];

[label release];

}

- (void)dealloc {

[window release];

[super dealloc];

}

@end

Download do arquivo


Share and Enjoy:
  • Print
  • Digg
  • Facebook
  • Google Bookmarks
  • email
  • PDF
  • RSS
  • Twitthis