1. Create an empty application first.
2. Create an objective-C Class
Appdelegate. h
# Import
<Uikit/uikit. h>
# Import
"Viewcontroller. H"
@ Interface appdelegate:
Uiresponder <uiapplicationdelegate>
{
Viewcontroller * viewcontroller;
}
@ Property (strong,
Nonatomic) uiwindow * window;
@ Property (nonatomic, retain) viewcontroller
* Viewcontroller;
@ End
Write appdelegate. m
//
// Appdelegate. m
// Noxibdemo
//
// Created by Wang doublejie on 12-4-8.
// Copyright (c) 2012 _ mycompanyname _. All rights reserved.
//
# Import
"Appdelegate. H"
@ Implementation appdelegate
@ Synthesize window =
_ Window;
@ Synthesize viewcontroller;
-(Void) dealloc
{
[_ Window
Release];
[Super
Dealloc];
}
-(Bool) Application :( uiapplication *) Application didfinishlaunchingwitexceptions :( nsdictionary
*) Launchoptions
{
Self. Window = [[uiwindow
Alloc] initwithframe: [[uiscreen
Mainscreen] bounds]
Autorelease];
// Override point for customization after application launch.
Viewcontroller = [[viewcontroller
Alloc] init];
Viewcontroller. View. bounds =
Cgrectmake (0, 0,320,480 );
Viewcontroller. View. Hidden =
No;
Self. Window. rootviewcontroller =
Self. viewcontroller;
[Self. Window
Makekeyandvisible];
Return yes;
}
-(Void) applicationwillresignactive :( uiapplication *) Application
{
// Sent when the application is about to move from active to inactive state. this can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition
To the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games shocould use this method to pause the game.
}
-(Void) applicationdidenterbackground :( uiapplication *) Application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationwillterminate: when the user quits.
}
-(Void) applicationwillenterforeground :( uiapplication *) Application
{
// Called as part of the transition from the background to the inactive state; here you can undo changes of the changes made on entering the background.
}
-(Void) applicationdidbecomeactive :( uiapplication *) Application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previusly in the background, optionally refresh the user interface.
}
-(Void) applicationwillterminate :( uiapplication *) Application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationdidenterbackground :.
}
@ End
Viewcontroller to create a uitextview; you can see the effect of the Code see http://download.csdn.net/detail/x1135768777/4193676