just learning this one, looking for some support for my hello world program.
it has a few files:
1. TESTViewController.h
2. TESTViewController.m
3. TESTAppDelegate.h
4. TESTAppDelegate.m
5. main.m
TESTViewController.h
CODE
//
// TESTViewController.h
// TEST
//
// Created by Aaron Sky on 6/14/08.
// Copyright __MyCompanyName__ 2008. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface TESTViewController : UIViewController {
}
@end
TESTViewController.m
CODE
//
// TESTAppDelegate.m
// TEST
//
// Created by Aaron Sky on 6/14/08.
// Copyright __MyCompanyName__ 2008. All rights reserved.
//
#import "TESTViewController.h"
@implementation TESTViewController
/*
Implement loadView if you want to create a view hierarchy programmatically
- (void)loadView {
}
*/
/*
Implement viewDidLoad if you need to do additional setup after loading the view.
- (void)viewDidLoad {
[super viewDidLoad];
}
*/
-(void)DispHelloWorld
{
int lmargin=0;
int height=40;
int width=320;
int tmargin=40;
CGRect frame = CGRectMake(lmargin, tmargin, width, height);
UILabel *label = [[UILabel alloc] initWithFrame: frame];
label.textAlignment - UITextAlignmentCenter;
label.text = @"Hello World";
label.font = [UIFont boldSystemFontOfSize: 40.0];
label.textColor = [UIColor colorWithRed: 255.0/255.0 green: 255.0/255.0 blue: 255.0/255.0 alpha: 1.0];
label.backgroundColor=[UIColor clearColor];
[self addSubview: label];
[label release];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
// Release anything that's not essential, such as cached data
}
- (void)dealloc {
[super dealloc];
}
@end
TESTAppDelegate.h
CODE
//
// TESTAppDelegate.h
// TEST
ç
TESTAppDelegate.m
CODE
//
// TESTAppDelegate.m
// TEST
//
// Created by Aaron Sky on 6/14/08.
// Copyright __MyCompanyName__ 2008. All rights reserved.
//
#import "TESTAppDelegate.h"
#import "TESTViewController.h"
@implementation TESTAppDelegate
@synthesize window;
@synthesize viewController;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
self.window=[[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.viewController=[[[TESTViewController alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease];
[window addSubview:viewController];
[TESTViewController DispHelloWorld];
[window makeKeyAndVisible];
}
- (void)dealloc {
[viewController release];
[window release];
[super dealloc];
}
@end
main.m
CODE
//
// main.m
// TEST
//
// Created by Aaron Sky on 6/14/08.
// Copyright __MyCompanyName__ 2008. All rights reserved.
//
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}