xcode--Control Properties

Source: Internet
Author: User

uiviewframe: Position and size can also be moved by Center transform: deformation one, properties of the control1. Frame1> represents the position and dimensions of the control, in the upper-left corner of the parent control as the origin of the coordinates (0,0))2>Modify this property to adjust the position and size of the control2. Center1>represents the focus of the control (in the upper-left corner of the parent control as the origin of the coordinates)2>Modify this property to adjust the position of the control3. Bounds1> represents the position and size of the control (in its own upper-left coordinate origin, where the position is always (0,0))2>Modify this property to adjust the size of the control only4.intTag1>indicates the label of the control2>Different controls can be distinguished by various markers5. Cgaffinetransform Transform1>indicates the state of the control's deformation (rotation angle, scale)2>to create a cgaffinetransform function*Cgaffinetransformmakescale (cgfloat sx, CGFloat sy); Creates an X, Y direction with a scaling ratio of not SX, SY, respectively.*cgaffinetransformmakerotation (cgfloat angle); Creates a deformation value for the angle of a rotation angle*Cgaffinetransformscale (Cgaffinetransform T, cgfloat SX, CGFloat SY) on the basis of the deformation value T, and then zoom, x, y-direction of the scale hungry respectively sx, SY, And then return a new deformation value.*cgaffinetransformrotate (Cgaffinetransform t, cgfloat angle) on the basis of the deformation value T, then rotation, rotation angle of angle, and then return a new deformation value two, Add controls to the controller's View[self.view Addsubview: subspace] Three, set the properties of the button//Create buttonUIButton *btn =[[UIButton alloc] init]; Btn.frame= CGRectMake (0,0, -, -); //set the properties of the button in normal state//set a background pictureUIImage *normal = [UIImage imagenamed:@"Btn_01.png"];        [Btn Setbackgroundimage:normal Forstate:uicontrolstatenormal]; [BTN Settitle:@"dot me."Forstate:uicontrolstatenormal];    [btn Settitlecolor:[uicolor Greencolor] forstate:uicontrolstatenormal]; //set the properties of the button in the highlighted StateUIImage *high = [UIImage imagenamed:@"Btn_02.png"];        [Btn Setbackgroundimage:high forstate:uicontrolstatehighlighted]; [BTN Settitle:@"dot me."forstate:uicontrolstatehighlighted]; [btn Settitlecolor:[uicolor Redcolor] forstate:uicontrolstatehighlighted];//Monitor button click[btn addtarget:self Action: @selector (Btnclick:) forcontrolevents:uicontroleventtouchupinside];- (void) Btnclick: (UIButton *) btn{NSLog (@ "———%"p,btn);}//Create a text input boxUitextfield *field =[[Uitextfield alloc] init]; Field.frame= CGRectMake ( -, -, -, -); Field.backgroundcolor=[Uicolor Redcolor];//The X of the midpointCGFloat CenterX = Self.view.frame.size.width *0.5; CGFloat CenterY= Self.view.frame.size.height *0.5' Field.center=Cgpointmake (CenterX, centery);//Set FontField.font = [Uifont systemfontofsize: -]; [Self.view Addsubview:field]; Iv. viewdidload1. This is a method of the controller2when the controller's view is created, it is called once. UISlider1the. Value property can get the current progress value2The value of the button has changed, triggering the use of the uicontroleventvaluechanged time VI, plist file1when a plist file is loaded, it returns a plist root node object (root) VII, the use of NSBundle1. Use NSBundle to access the contents of a resource bundle2If you access the contents of the most important resource bundle in the software, you should use Mainbundlensbundle*bundle =[NSBundle Mainbundle];3get the full path of the file using NSBundle nsstring*path =[Bundle Pathforresource: "filename" oftype:@ "plist"];4. NSBundle. Getting a picture1. NSString *path = [[NSBundle mainbundle] Pathforresource:@"resourcename"OfType@"ResourceType"]; UIImage*image =[[UIImage Imagewithcontentsoffile:path]; 2. UIImage *image = [UIImage imagenamed:@"ImageName"]; ii. obtain a plist file Nsarray*array =[[nsarray alloc] initwithcontentsoffile:[[nsbundle Mainbundle] Pathforresource:@"name"OfType:@"plist"]]; Nsdictionary*dict=[array Objectatindex:index];//Convert the contents of the plist file into a dictionary

xcode--Control Properties

Related Article

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.