1.1-(void) layoutsubviews;
* When a control's frame changes, it is automatically called
* Typically here the child controls inside the layout (set the child control's frame)
* Be sure to call Super's Layoutsubviews method
1.2-(void) Didmovetosuperview;
* When a control is added to the parent control, it is called
1.3-(void) Willmovetosuperview: (UIView *) Newsuperview;
* When a control is about to be added to the parent control it calls the
@interfaceUiview:uiresponder<nscoding, Uiappearance, Uiappearancecontainer, uidynamicitem>/** * Initialize a UI control with a frame*/- (ID) initWithFrame: (CGRect) frame;//YES: Ability to interact with users@property (nonatomic,getter=isuserinteractionenabled) BOOL userinteractionenabled;//default is YES//a tag for the control (the parent control can find the corresponding child control via tag)@property (nonatomic) nsinteger tag;//default is 0//layer (can be used to set fillet effect \ Shadow effect)@property (Nonatomic,ReadOnly, retain) Calayer *layer;@end@interfaceUIView (uiviewgeometry)//position and size (in the upper-left corner of the parent control is the coordinate origin (0, 0))@property (nonatomic) cgrect frame;//position and size (in its own upper left corner as the origin of the coordinates (0, 0))@property (nonatomic) cgrect bounds;//midpoint (in the upper-left corner of the parent control is the coordinate origin (0, 0))@property (nonatomic) Cgpoint Center; //deformation properties (pan \ Zoom \ Rotation)@property (nonatomic) Cgaffinetransform transform;//default is Cgaffinetransformidentity//YES: Multi-touch support@property (nonatomic,getter=ismultipletouchenabled) BOOL multipletouchenabled;//default is NO@end@interfaceUIView (uiviewhierarchy)//Parent Control@property (Nonatomic,ReadOnly) UIView *Superview;//child control (the newly added control defaults to the Subviews array, and the newly added control is displayed by default on top \ Topmost)@property (Nonatomic,ReadOnly, copy) Nsarray *subviews;//gets the window where the current control is located@property (Nonatomic,ReadOnly) UIWindow *window;//removing a control from a parent control- (void) Removefromsuperview;//Add a child control (you can insert a child control into the Subviews array, index this position)- (void) Insertsubview: (UIView *) View Atindex: (nsinteger) index;//swap the position of the child controls held 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 is displayed by default on top \ Topmost)- (void) Addsubview: (UIView *) view;//Add a child control view (blocked under Siblingsubview)- (void) Insertsubview: (UIView *) View Belowsubview: (UIView *) Siblingsubview;//Add a child control view (cover on top of Siblingsubview)- (void) Insertsubview: (UIView *) View Abovesubview: (UIView *) Siblingsubview;//pull a child control to the top (topmost) to display- (void) Bringsubviewtofront: (UIView *) view;//Drag a child control to the bottom (the bottommost) to display- (void) Sendsubviewtoback: (UIView *) view;/** System Automatic call (leave subclass to implement) **/- (void) Didaddsubview: (UIView *) Subview;- (void) Willremovesubview: (UIView *) Subview;- (void) Willmovetosuperview: (UIView *) Newsuperview;- (void) Didmovetosuperview;- (void) Willmovetowindow: (UIWindow *) NewWindow;- (void) Didmovetowindow;/** Automatic system call **///is not a child control of a view or child control (whether it is a descendant of a view)-(BOOL) Isdescendantofview: (UIView *) view;//returns YES to self.//to get the corresponding child control (or child control of child controls) by tag-(UIView *) Viewwithtag: (nsinteger) tag;//recursive search. Includes self/** System Automatic call (leave subclass to implement) **///The control's frame is called when it is changed, and the location and dimensions of the layout child control are typically overridden here//after rewriting this write method, be sure to call [Super Layoutsubviews];- (void) layoutsubviews;@end@interfaceUIView (uiviewrendering)//YES: Content that extends beyond the bounds of the control is cut off@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: Show@property (nonatomic,getter=Ishidden) BOOL hidden;//Content Mode@property (nonatomic) Uiviewcontentmode Contentmode;//default is Uiviewcontentmodescaletofill@end@interfaceUIView (uiviewanimationwithblocks)+ (void) Animatewithduration: (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
OBJECTIVE-C Study notes: How to use UIView