Code initialization in iPhone Development

Source: Internet
Author: User
Tags mail code

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:

 
 
  1. Convert the original line:
  2. Int retVal = UIApplicationMain (argc, argv, nil, nil );
  3. Changed:
  4. Int retVal = UIApplicationMain (argc, argv, nil, @ "CodingWindowDemoAppDelegate ");

5. After modifying CodingWindowDemoAppDelegate. h, the Code is as follows:

 
 
  1. #import <UIKit/UIKit.h>@interface CodingWindowDemoAppDelegate : NSObject <UIApplicationDelegate> {  
  2.   UIWindow *window;}//@property (nonatomic, retain) IBOutlet UIWindow *window;@end 

6. After modifying CodingWindowDemoAppDelegate. m, the Code is as follows:

 
 
  1. # Import "CodingWindowDemoAppDelegate. h"
  2. @ Implementation CodingWindowDemoAppDelegate //
  3. @ Synthesize window; # pragma mark-
  4. # Pragma mark Application lifecycle
  5. -(BOOL) application :( UIApplication *) application didfinishlaunchingwitexceptions :( NSDictionary *) launchOptions {
  6. // Override point for customization after application launch.
  7. Window = [[UIWindow alloc] initWithFrame: CGRectMake (0, 0,320,480)];
  8. Window. backgroundColor = [UIColor blueColor];
  9. // Add the code for loading the view.
  10. //...
  11. [Window makeKeyAndVisible];
  12. Return YES;
  13. } # Pragma mark-
  14. # Pragma mark Memory management
  15. -(Void) dealloc {
  16. [Window release];
  17. [Super dealloc];
  18. }
  19. @ End

Summary:IPhone DevelopmentInitialize with codeAPPThe content of Window in is complete. I hope this article will help you!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.