The IOS Windows window uses

Source: Internet
Author: User

Tag: and object its finish SDI window needs har to decide

//Once the program is started, it is called once .-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchoptions{//1. Create UIWindowSelf.window =[[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds]; //set the background color of UIWindowSelf.window.backgroundColor =[Uicolor Redcolor]; //let the UIWindow show up (let the window be the main window and show it)//an application can have only one main window[Self.window makekeyandvisible]; //let UIWindow become the main window//[Self.window Makekeywindow]; //2. Create a window againUIWindow *w2 = [[UIWindow alloc] Initwithframe:cgrectmake ( -, -, $, $)]; W2.backgroundcolor=[Uicolor Yellowcolor];    [W2 Makekeyandvisible]; SELF.W2=W2; //3. Create two text input boxes//3.1 Adding a text input box to a windowUitextfield *tx1 = [[Uitextfield alloc] Initwithframe:cgrectmake (Ten,Ten, $, +)]; Tx1.borderstyle=Uitextborderstyleroundedrect;        [Self.window ADDSUBVIEW:TX1]; //3.2 Adding a text input box to the W2Uitextfield *tx2 = [[Uitextfield alloc] Initwithframe:cgrectmake (Ten,Ten, -, +)]; Tx2.borderstyle=Uitextborderstyleroundedrect;        [Self.w2 ADDSUBVIEW:TX2]; //get the main window of the applicationNSLog (@"%@", [uiapplication Sharedapplication].keywindow); returnYES;}- (void) test{//1. Create UIWindowSelf.window =[[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds]; //2. Set the background color of the UIWindowSelf.window.backgroundColor =[Uicolor Redcolor]; //Create a controller//Njviewcontroller *VC = [[Njviewcontroller alloc] init]; //Add a view of the controller to the UIWindow//Issue 1: When the view has some events, notify the controller, but the controller and destroyed, so there may be an unknown error    /*Issue 2: When a rotation event occurs, the UIApplication object passes the rotation event to the UIWindow UIWindow and then passes the rotation event to its root controller, which is determined by the root controller whether it needs to be rotated uiapplication- >UIWindow-> Root Controller*/    //[Self.window AddSubview:vc.view]; //set the root controller for UIWindow (this is the recommended way)//Self.window.rootViewController = VC; //Uiswitch *switchbtn = [[Uiswitch alloc] init]; //[Self.window addsubview:switchbtn]; //3. Let the UIWindow appear (make the window the main window and show it)//an application can have only one main window[Self.window makekeyandvisible]; //let UIWindow become the main window//[Self.window Makekeywindow];}

The IOS Windows window uses

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.