Summary of common properties of uiview

Source: Internet
Author: User
Tags uicontrol
I. Common Properties of uiview 1. frame position and size (starting from the upper left corner of the parent control (0, 0) 2. center Point (with the upper left corner of the parent control as the origin () 3. bounds position and size (with the upper left corner as the origin (0, 0) 4. transform deformation attributes (scaling, rotating) 5. backgroundcolor background color 6.tag identifier (the parent control can find the corresponding child Control Based on this identifier, not the same as the Child control in the same parent control) 7. hidden settings to hide 8. alpha transparency (0 ~ 1); 9. opaque opacity (0 ~ 1); 10. whether userinteractionenabled can interact with users (yes) 11. superview parent control 12. subviews subcontrol 13. contentmode content display mode stretch adaptive [view viewwithtag: 10]; [btn1 9 btn2 10 imageview 2 10] II. common Methods of uiview 1. addsubview Add sub-control, added to the top (last in subviews) 2. removefromsuperview is removed from the parent control. 3. viewwithtag: the parent control can find the corresponding control based on the tag ID (traverse all child Controls) 4. insertsubview: atindex: add the child control to the specified position. 5. use two methods to execute the animation + (void) beginanimations :( nsstring *) animationid context :( void *) context ;/**.. code for executing the animation .. **/+ (void) commitanimations; 6. animation execution with Blok/* duration animation duration animations stores the Code Completion that requires forest animation execution. The operation code to be executed after the animation is completed */+ (void) animatewithduration :( nstimeinterval) duration animations :( void (^) (void) animations completion :( void (^) (bool finished) completion 3. uicontrol1. as long as you inherit uicontrol, you can simply process events (Click events, value change events) 2. inherits the uibutton subclass of uicontrol. uislider. uiswitch. uidatepicker, etc. 3. when you need to listen to the time of a subcontrol, the solution is as follows: 1>. check whether it inherits from uicontrol2>. check whether the delegate attribute exists. 4. common attribute 1> enabled processing time 2> contentverticalalignment content layout in the vertical direction 3> contenthorizontalalignment content layout in the horizontal direction 5. common method 1> Add the listener/* Target listener object the method called when the action event is triggered, call the target Method */-(void) addtarget :( ID) target action :( SEL) action forcontrolevents :( uicontrolevents) controlevents; 2> after the listener is deleted, the listener will not be notified when the event is triggered, the target action method will no longer be called-(void roemovetarget :( ID) target action:] (SEL) Action forcontrolevents:] (uicontrolevents) controlevents ); 3> get all listener objects-(nsset *) alltargets; 4, uilabel1. common attributes 1> text content displayed by text 2> textcolor text color 3> Font font 4> shadowcolor text shadow color 5> shadowoffset shadow deviation distance (horizontal width deviation) distance, height vertical direction of the idea distance, under a positive number) 6> textalignment set text layout method (left, right, center ). 7> numberoflines allows a maximum of several lines of text (if it is 0, automatic line feed ). 5. uibutton //. uislider. uiswitch. uidatepicker, etc. 1. common properties 1> obtain an internal uilabel object using titlelabel 2> obtain an internal uiimageview object using imageview 2. common method 1> set the text content displayed by the internal uilabel // when setting the button text, it cannot be BTN. titlelabel. TEXT = @ "4324324";-(void) settitle :( nsstring *) Title forstate :( uicontrolstate) State; // default is nil. title is assumed to be single line2> set the text color of the internal uilabel-(void) settitlecolor :( uicolor *) color forstate :( uicontrolstate) State ui_appearance_selector; // default if nil. use opaque white3> set the text shadow color of the internal uilabel-(void) settitleshadowcolor :( uicolor *) color forstate :( uicontrolstate) State ui_appearance_selector; // default is nil. use 50% black4> set the image (void) setimage :( uiimage *) image forstate :( uicontrolstate) state of the internal uiimageview; // default is nil. shocould be same size if different for different States5> set the image of the internal uiimageview-(void) setbackgroundimage :( uiimage *) image forstate :( uicontrolstate) State ui_appearance_selector; // default is nil6> the following two methods must be handed over to the subclass for rewriting // return the frame (position and size)-(cgrect) titlerectforcontentrect (cgrect) contentrect; // return the size and position of the internal uiimage-(cgrect) imagerectforcontentrect :( cgrect) contentrect; 7> the following methods can obtain attributes in different States-(nsstring *) titleforstate :( uicontrolstate) State; // These getters only take a single state value-(uicolor *) titlecolorforstate :( uicontrolstate) State;-(uicolor *) titleshadowcolorforstate :( uicontrolstate) State; -(uiimage *) imageforstate :( uicontrolstate) State;-(uiimage *) reset :( uicontrolstate) State;-(nsattributedstring *) attributedtitleforstate :( uicontrolstate) State ns_available_ios (6_0 );

 

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.