iphone first day note March 28, 2016 (Monday) a.m. iphone development Primer

Source: Internet
Author: User
Tags call back

1. Switch Home key: COMMAND + SHIFT + H;2. Info.plist application does not run in background YES ****************************main******************************
1<font size="3">#import<UIKit/UIKit.h>2 #import "AppDelegate.h"3 4 intMainintargcChar*argv[]) {5 @autoreleasepool {6         returnUiapplicationmain (argc, argv, Nil, nsstringfromclass ([appdelegateclass]));7         //parameter Three: uiapplication instance object (unique)8         //[uiapplication sharedapplication] can be used to get application-unique object notifications9         //parameter Four: Specifies the proxy class for the current application. Used to process life-cycle related methods. If the program starts a callback method, program memory is not sufficient callback method, the program exits the callback method. Ten          One     } A } -appdelegate.h************ - #import<Foundation/Foundation.h> the #import<UIKit/UIKit.h> - //proxy classes for Applications - @interfaceAppdelegate:uiresponder <UIApplicationDelegate> -  +@property (Strong, nonatomic) UIWindow *window;//_window -  + @end</font>
*************************appdelegate.h*************************
 1  <font size= " 3   > #import  <foundation/ Foundation.h>2   #import  <uikit/ Uikit.h>3  //  The application's proxy class  4   @interface  Appdelegate:uiresponder <uiapplicationdelegate>5  6  @  Property (Strong, Nonatomic) UIWindow *window; // _window  7   @end  </font> 
*************************appdelegate.m*************************
1<font size="3">#import "AppDelegate.h"2 3 @interfaceappdelegate ()4 5 @end6 7 @implementationappdelegate8 9 //the callback method once the program starts. Ten-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchoptions { One     //To explain Auiviewcontroller* CTR =[[Uiviewcontroller alloc] init]; - [Self.window setrootviewcontroller:ctr]; -  the     //Gets the width and height of the current device's screen -CGRect rect = [[UIScreen mainscreen] bounds];//CGRect relative to himself -     //the creation process of the main window -Self.window = [[UIWindow alloc] Initwithframe:cgrectmake (0,0, Rect.size.width, Rect.size.height)];//view: Relative to another view +      -[Self.window makekeyandvisible];//make the main window visible +      ASelf.window.backgroundColor = [Uicolor Greencolor];//set the main window background color at         -     returnYES; - } - //The program is about to cancel the active state callback method.  -- (void) Applicationwillresignactive: (UIApplication *) Application {} -  in //how the program actually goes back in the background -- (void) Applicationdidenterbackground: (UIApplication *) Application {} to  + //the procedure is about to enter the foreground callback method -- (void) Applicationwillenterforeground: (UIApplication *) Application {} the  * //method that will callback when the program is active $- (void) Applicationdidbecomeactive: (UIApplication *) Application {}Panax Notoginseng  - //Once the device does not support background operation, clicking the Home button will call back this method.  the- (void) Applicationwillterminate: (UIApplication *) Application {} +  A @end</font>

Iphone first day note March 28, 2016 (Monday) a.m. iphone development Introduction

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.