////VIEWCONTROLLER.M//Common Properties for 08-uiview (size and position)////frame: Positioned relative to the upper-left corner of the parent control//bounds: Change the length width, the upper left corner is relative to oneself//Center:#import "ViewController.h"@interfaceViewcontroller ()/** Label*/@property (nonatomic, weak) UILabel*label;@end@implementationViewcontroller- (void) viewdidload {[Super viewdidload]; //Create a Uilabel objectUILabel *label =[[UILabel alloc] init]; //Set FRAME (position and size)Label.frame = CGRectMake ( -, -, -, -);//parent control as the origin point//Set Background colorLabel.backgroundcolor =[Uicolor Yellowcolor]; //add to view in controller[Self.view Addsubview:label];//add it in.Self.label =label;}-(ibaction) bounds {//after changing the size iOS9, the center point will not change, extending to the surroundingSelf.label.bounds = CGRectMake ( -, -, $, -);}-(ibaction) Center {//Change Position//self.label.center = cgpointmake (100, 100); //Show in the middleSelf.label.center = Cgpointmake (Self.view.frame.size.width *0.5, Self.view.frame.size.height *0.5); }-(ibaction) changeframe {//Mode 1//Self.label.frame = CGRectMake (200, 100, 100, 60); //Mode 2Self.label.frame = (CGRect) {{ -, -}, { -, -}}; //Mode 3//struct is a value pass, not an address pass//Self.label.frame.size.width + + +;CGRect frame =Self.label.frame;//frame.origin.x-=;//Change x Value//FRAME.ORIGIN.Y + + +;//Change the Y value//frame.size.width + =;//Change WidthFrame.size.height + = -;//Change HeightSelf.label.frame =frame; }@end
Common Properties for Ios4--uiview (size and position)