IOS Basics first Section UIview

Source: Internet
Author: User

-(BOOL) application: (uiapplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchoptions {

Override point for customization after application launch.

//load at first run time

//Run only once each time, the system automatically listens .

self. Window = [[UIWindow alloc]initwithframe: CGRectMake(0, 0, +, 568)];

Background color settings

[Self. Window setbackgroundcolor: [Uicolor Graycolor]];

//Set Home screen and display

[Self. Window makekeyandvisible];

Create UIView

UIView *aview = [[UIView alloc]initwithframe: CGRectMake(0, +,--)];

[Aview setbackgroundcolor: [Uicolor Orangecolor]];

[Self. Window addsubview: Aview];

UIView *bview = [[UIView alloc]initwithframe: CGRectMake(Ten , +, +)];

[Bview setbackgroundcolor: [Uicolor Redcolor ]];

[Aview Addsubview:bview];

UIView *cview = [[UIView alloc]initwithframe: CGRectMake( +, +, +)];

[CView setbackgroundcolor: [Uicolor Greencolor]];

[Aview Addsubview:cview];

Act 1. assigning a property to a value modification

CView. frame = CGRectMake (0, +, +);

Act 2.

[CView Setframe:cgrectmake (50, 0, 50, 50)];

[Aview release];

[Self.window release];

//Get tried by the parent trying to

Strong Turn (UIWindow)

UIWindow * Fatherview = (UIWindow *) [Aview Superview];

NSLog (@ "father =%@", fatherview);

//Get all the children the parent tries to try

returns an array

Nsarray * arr = [Aview subviews];

NSLog (@ "subs =%@", arr);

Insert a View

UIView *newview = [[UIView alloc]initwithframe: CGRectMake( +, +, +)];

[Newview setbackgroundcolor: [Uicolor Whitecolor]];

[Aview Insertsubview:newview Abovesubview:bview];

[Newview release];

//Put above B but the array position after inserting the view array position, the more

Management attempt hierarchy

put the Newview on top of the attempt.

[Aview Bringsubviewtofront:newview];

NSLog (@ "%@", arr);

NSLog (@ "%@", [Aview subviews]);

try to put the Newview in the bottom .

[Aview Sendsubviewtoback:newview];

NSLog (@ "%@", [Aview subviews]);

//Swap two sub-index locations to try to

[Aview exchangesubviewatindex: 0 withsubviewatindex: 2];

NSLog (@ "%@", [Aview subviews]);

remove receiver from the parent map

Remove The Newview from the

[Newview Removefromsuperview];

NSLog (@ "%@", [Aview subviews]);

Set hidden Properties

Aview.hidden = YES;

[Aview Sethidden:NO];

//Set Transparency property call

Bview.alpha = 0.5;

[Bview setalpha:1];

to mark a view

Bview. tag =1;

//Center point Child View relative to parent view

Bview. Center = Cgpointmake (+);

return YES;

}

IOS Basics first Section UIview

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.