IPhone DevelopmentCode InitializationAPPWindow is the content to be introduced in this article.Iphone DevelopmentHow to initializeAPPWindow in, this example describes how to use the code to create an iPhoneAppSo that ourAppIt does not rely on any nib file and is fully implemented by mail code.
1. Create a new project "CodingWindowDemo" based on "window-based application ";
2. Delete the MainWindow. xib file;
3. Delete the "Main nib file base name" line in the CodingWindowDemo-Info.plist file;
4. Modify the main. m code:
- Convert the original line:
- Int retVal = UIApplicationMain (argc, argv, nil, nil );
- Changed:
- Int retVal = UIApplicationMain (argc, argv, nil, @ "CodingWindowDemoAppDelegate ");
5. After modifying CodingWindowDemoAppDelegate. h, the Code is as follows:
- #import <UIKit/UIKit.h>@interface CodingWindowDemoAppDelegate : NSObject <UIApplicationDelegate> {
- UIWindow *window;}//@property (nonatomic, retain) IBOutlet UIWindow *window;@end
6. After modifying CodingWindowDemoAppDelegate. m, the Code is as follows:
- # Import "CodingWindowDemoAppDelegate. h"
- @ Implementation CodingWindowDemoAppDelegate //
- @ Synthesize window; # pragma mark-
- # Pragma mark Application lifecycle
- -(BOOL) application :( UIApplication *) application didfinishlaunchingwitexceptions :( NSDictionary *) launchOptions {
- // Override point for customization after application launch.
- Window = [[UIWindow alloc] initWithFrame: CGRectMake (0, 0,320,480)];
- Window. backgroundColor = [UIColor blueColor];
- // Add the code for loading the view.
- //...
- [Window makeKeyAndVisible];
- Return YES;
- } # Pragma mark-
- # Pragma mark Memory management
- -(Void) dealloc {
- [Window release];
- [Super dealloc];
- }
- @ End
Summary:IPhone DevelopmentInitialize with codeAPPThe content of Window in is complete. I hope this article will help you!