A summary of common property methods for IOS UIView _ios

Source: Internet
Author: User

The following example code gives you a detailed introduction to the common property methods for iOS UIView, as shown in the following code:

Uiview:uiresponder/** Initializes a UI control/(ID) initWithFrame by a frame: (CGRect) frame; YES: Can interact with the user @property (nonatomic,getter=isuserinteractionenabled) BOOL userinteractionenabled;        A tag of the default is YES//control (the parent control can find the corresponding child control by tag) @property (nonatomic) nsinteger tag;
The default is 0//layer (which can be used to set rounded corners effect \ Shadow effect) @property (Nonatomic,readonly,retain) Calayer *layer;
@interface UIView (uiviewgeometry)//Position and dimensions (in the upper-left corner of the parent control as the coordinate origin (0, 0)) @property (nonatomic) cgrect frame;
Position and size (in the upper-left corner of the coordinate origin (0, 0)) @property (nonatomic) cgrect bounds;   
Midpoint (in the upper-left corner of the parent control as the coordinate origin (0, 0)) @property (nonatomic) Cgpoint Center;  Deformation properties (pan \ Zoom \ Rotate) @property (nonatomic) Cgaffinetransform transform; Default is cgaffinetransformidentity/YES: Multi-Touch @property (nonatomic,getter=ismultipletouchenabled) BOOL supported  multipletouchenabled;
The default is NO @end @interface uiview (Uiviewhierarchy)//Parent control @property (nonatomic,readonly) UIView *superview; Child controls (the newly added control defaults to the Subviews array, and the newly added control defaultsare shown on the top top top) @property (nonatomic,readonly,copy) Nsarray *subviews;
Gets the window @property (nonatomic,readonly) UIWindow *window where the current control is located;
Removes a control from the parent control-(void) Removefromsuperview;
Add a child control (you can insert a child control into the subviews array in the position of index)-(void) Insertsubview: (UIView *) View Atindex: (nsinteger) index;
Swap the position of the child control in the Subviews array-(void) Exchangesubviewatindex: (Nsinteger) index1 Withsubviewatindex: (Nsinteger) Index2;
Add a child control (the newly added control defaults to the Subviews array, and the newly added control defaults to the top \ Top)-(void) Addsubview: (UIView *) view;
Add a child control view (blocked under Siblingsubview)-(void) Insertsubview: (UIView *) View Belowsubview: (UIView *) Siblingsubview;
Add a child control view (covered above siblingsubview)-(void) Insertsubview: (UIView *) View Abovesubview: (UIView *) Siblingsubview;
Pull one of the child controls to the top (top) to display-(void) Bringsubviewtofront: (UIView *) view;
Pull one of the child controls to the bottom (bottommost) to display-(void) Sendsubviewtoback: (UIView *) view;
The/** system is automatically invoked (left to subclass to implement) **/-(void) Didaddsubview: (UIView *) Subview;
-(void) Willremovesubview: (UIView *) Subview; -(void) Willmovetosuperview: (UIView *) NewsupeRview;
-(void) Didmovetosuperview;
-(void) Willmovetowindow: (UIWindow *) NewWindow;
-(void) Didmovetowindow; The/** system automatically invokes **///is a child control of the view or child control (whether it is a descendant of view)-(BOOL) Isdescendantofview: (UIView *) view;
 Returns YES for self.   The corresponding child control (or child control) can be obtained by tag-(UIView *) Viewwithtag: (nsinteger) tag; Recursive search. Includes self/** system automatic invocation (left to subclass to implement) when the **///control's frame changes, it is invoked, where the layout child control is overridden, and the location and size of the placement sub-controls are overridden//The Write method is rewritten and must be called [Super Layoutsubviews]
-(void) layoutsubviews;
@end @interface UIView (uiviewrendering)/YES: Content that is outside the bounds of the control is clipped @property (nonatomic) BOOL clipstobounds; Background color @property (nonatomic,copy) Uicolor *backgroundcolor;           Default is nil//transparency (0.0~1.0) @property (nonatomic) cgfloat Alpha;           Default is 1.0/YES: Opaque No: Transparent @property (nonatomic,getter=isopaque) BOOL opaque;
 Default is yes/Yes: Hide NO: Displays @property (Nonatomic,getter=ishidden) BOOL hidden; Content mode @property (nonatomic) Uiviewcontentmode conTentmode; Default is Uiviewcontentmodescaletofill @end//Animation @interface UIView (uiviewanimationwithblocks) + (void) animatewithdu Ration: (nstimeinterval) Duration delay: (nstimeinterval) Delay options: (uiviewanimationoptions) Options animations: (
void (^) (void)) animations completion: (void (^) (BOOL finished)) completion; + (void) Animatewithduration: (nstimeinterval) duration animations: (void (^) (void) animations completion: (void (^) (
BOOL finished)) completion;
+ (void) Animatewithduration: (nstimeinterval) duration animations: (void (^) (void) animations; + (void) Animatewithduration: (nstimeinterval) Duration delay: (nstimeinterval) Delay usingspringwithdamping: (cgfloat) Dampingratio initialspringvelocity: (cgfloat) Velocity options: (uiviewanimationoptions) options animations: (void (^) (
 void)) Animations completion: (void (^) (BOOL finished)) completion; @end

The above is a small set to introduce the common properties of iOS UIView, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.