A friend who has not studied language is advised to learn the basics of programming based on the C language, so it's easier to learn the UI. later I will continue to update the basic learning content of the UI there is a need to C, OC learning materials friends can give me a message. (in the code part is the MRC mode, want to know the friend can go to see OC memory management)
1, frame, center is equivalent to the parent view, change the view itself frame, center will directly affect itself on its parent view display position.
2, bounds is relative to itself, change the value of bounds will directly affect the position of the origin of the coordinate system. In turn, it affects where the child view is located 3, the default value for a view bounds is (0, 0, wide, high), because the two values preceding the bounds x, y mean the meaning is the distance from the upper-left corner of the view itself to the origin of its own coordinate system. Because the view itself is coincident with the upper-left corner, it is 04, changing the X and Y values in the bounds of a view does not cause changes in its position because, first, the parent view's bounds does not change, its frame and center do not have any changes, So the relationship with the parent view doesn't change any more, so it doesn't move. App startup process//Application load start complete, will run. -(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions// Application is about to abandon active state-(void) Applicationwillresignactive: (uiapplication *) application//application has entered the background, need to save a series of operations such as information stop timer. -(void) Applicationdidenterbackground: (UIApplication *) application//will be entering the front desk-(void) Applicationwillenterforeground :(uiapplication *) application//application enters active state, running-(void) Applicationdidbecomeactive: (uiapplication *) application// The way the application will go when it exits. However, after iOS4.0, the method that is used by the application to enter the background instead of-(void) Applicationwillterminate: (uiapplication *) application view's various properties and methods
Canvas
UIView *containerview = [[UIView alloc] initwithframe:self. Window. Bounds];
Containerview. backgroundcolor = [uicolor whitecolor];
[self. Window addsubview: Containerview];
[Containerview release];
UIView *blueview = [[UIView alloc] initwithframe:cgrectmake( ( a );
Blueview. backgroundcolor = [uicolor bluecolor];
// Set the location of the center point
Blueview. Center = Self. Window. Center;
// set opacity to 50%
Blueview. Alpha = 0.5;
// Add a marker to the Blue view
Blueview. tag = 101;
[Containerview Addsubview: Blueview];
// Get the parent view of the Blue view
NSLog(@ "Superview is%@ Containerview is%@", Blueview. Superview, Containerview);
NSLog(@ "Subviews is%@ Blueview is%@", Containerview. Subviews, Blueview);
// use tag to find Blueview and change its color to red
[Containerview Viewwithtag:101]. BackgroundColor = [uicolor redcolor];
[Blueview release];
UIView *yellowview = [[UIView alloc] initwithframe:cgrectmake(200 , (a );
Yellowview. backgroundcolor = [uicolor yellowcolor];
// to have the parent view insert a new child view under one subscript
[Containerview insertsubview: Yellowview atindex:1];
[Yellowview release];
// Remove attempt to remove a view from the parent view
[Blueview Removefromsuperview];
The first time to write a blog, there is a lot of bad places to forgive.
Getting Started with IOS UI