Bringsubviewtofront:
moves the specified child view to the top level
-(void) Bringsubviewtofront: (UIView *) view
Parameters
View
View to move to the top layer
Convertpoint:fromview:
converts a point from one coordinate system to the receiver's coordinate system
-(Cgpoint) Convertpoint: (cgpoint) point fromview: (UIView *) view
Parameters
Point
A point on a coordinate system in a view
View
A view contains a point and his own coordinate system. If the graph is nil, then this method will attempt to convert the window-based coordinate system. Otherwise the view and that recipient must belong to the same UIWindow object.
return value
A point that transitions to the receiver coordinate system
Convertpoint:toview:
converts a point from the recipient coordinate system to the given view coordinate system
-(Cgpoint) Convertpoint: (cgpoint) point toview: (UIView *) view
Parameters
Point
A point in the caller's coordinate system
View
A view that contains the points that need to be converted. If the view is nil, then this method will be converted to window-based coordinates. Otherwise the view and receiver belong to the same UIWindow object.
return value
Points converted from a view-based coordinate system
Convertrect:fromview:
Convert a rectangle from another view coordinate system to a recipient coordinate system。
-(CGRect) Convertrect: (cgrect) rect fromview: (UIView *) view
Parameters
Rect
A rectangle in the view coordinate system
View
A view has a rectangle inside his coordinate system. If the view is nil, then this method will be converted based on the window. Otherwise the view and receiver must all belong to the same UIWindow object
return value
The converted Rectangle
The converted Rectangle
Convertrect:toview:
Convert a rectangle in the recipient coordinate system to a different view
-(CGRect) Convertrect: (cgrect) rect toview: (UIView *) view
Parameters
Rect
A rectangle in the recipient's coordinate system
View
The target view object to convert past. If the view is nil, this method will be converted based on the window coordinate system. No view and receiver must belong to the same UIWindow object
return value
A converted Rectangle
DrawRect:
draw a rectangle in the receiver view (custom UIView)
-(void) DrawRect: (cgrect) rect
Parameters
Rect
A defined rectangle that needs to be drawn
Discuss
Subclasses override this method if they really want to draw their own custom view. If the subclass is a container for other views then it does not need to override this method. The default implementation doesn't do anything. If your custom view is a UIView subclass, you do not need to invoke its parent class implementation. Note If its parent class implements the drawing and the Opacity property is yes then each subclass needs to fill the rectangle.
When this method is called, the receiver can assume that his frame has been converted on the coordinates and that the bounding rectangle has been applied; all he has to do is draw a custom method. Use the Uigraphicsgetcurrentcontext method to get the current graphic content for plotting, the coordinate origin in the upper-left corner. Do not keep picture content when he can be DrawRect: This method is called.
Hittest:withevent:
returns the specific point of the farthest derivation (including itself) in the recipient view hierarchy. (Touch event)
-(UIView *) HitTest: (cgpoint) point withevent: (Uievent *) event
Parameters
Point
Points in the recipient coordinate system
Event
The event that triggers this method, or if the method is pre-invoked, returns nil.
return value
The farthest derivation point for a View object. If this point is outside the receiver, it returns nil.
Discuss
This method sends pointinside:withevent through the hierarchy of views: messages to each child view are used to determine which child view needs to receive touch events. If pointinside:withevent: Returns Yes, the hierarchy of views runs through; otherwise the branch of the view hierarchy is negated. You don't need to call this method much, but you need to rewrite the touch event that it uses to hide the child views.
If the view is hidden, the user interaction is forbidden or the transparent value is less than 01 then this method is not available
Pointinside:withevent:
returns a Boolean value indicating whether the recipient contains a specific point
-(BOOL) Pointinside: (cgpoint) point withevent: (Uievent *) event
Parameters
Point
A point within the receiver coordinate system
Event
The target event for this method, or if the method is pre-called, returns nil
return value
Returns no if the point returns Yes within the receiver boundary
Isdescendantofview:
returns a Boolean value indicating whether the recipient is a child of a given view or pointing to that view
-(BOOL) Isdescendantofview: (UIView *) view
Parameters
View
A view to test the relationship of a child view in the view hierarchy
return value
If the recipient is a child view of the view, returns Yes, or the view is the receiver;
layoutifneeded
Arrange child views if you need to.
-(void) layoutifneeded
Discuss
Use this method to focus on the arrangement of the child views before drawing
Layoutsubviews
Arranging child views
-(void) layoutsubviews
Discuss
When Layoutifneeded is called, subclasses are used to override this method to arrange the child views. The default implementation of this method doesn't do anything.
Sendsubviewtoback:
moves the specified child view to the back of its adjacent view
-(void) Sendsubviewtoback: (UIView *) view
Parameters
View
A child view is used to move behind it.
Setneedsdisplay
the bounding rectangle of the control receiver is marked as needing to be displayed
-(void) Setneedsdisplay
Discuss
By default, changes to the view geometry are automatically redrawn without the need to call the DrawRect: method. Therefore, you need to ask the view to redraw when the view's data or state changes. In this sense, the Setneedsdisplay message is sent to the view. Any UIView object marked as needing to be displayed will be automatically redrawn in the application loop.
Setneedsdisplayinrect:
The specific rectangular area of the tag recipient is required to be displayed, or additional invalid areas are added by the recipient
-(void) Setneedsdisplayinrect: (CGRect) Invalidrect
Parameters
Invalidrect
The rectangular area of the tag receiver is invalid; he needs to define it in the receiver coordinate system.
Discuss
By default, changes to the view geometry are automatically redrawn without the need to call the DrawRect: method. Therefore, you need to ask the view to redraw when the view's data or state changes. Use this method or use the Setneedsdisplay method to mark where the view needs to be displayed.
Setneedslayout
set to rearrange when the child view is displayed
-(void) setneedslayout
Discuss
If you call this method between the next display method, then layoutifneeded arranges the child view; otherwise it won't do anything.
Sizethatfits:
calculates and returns the size of a best fit recipient child View
-(Cgsize) Sizethatfits: (cgsize) size
Parameters
Size
Recipient's preferred size
return value
A new size to accommodate the receiver sub-view
Discuss
The default implementation returns the size parameter subclasses override this method to return the size of a particular view. For a particle, Uiswitch returns a modified size, Uiimageview returns the size of the image without changing the size of the receiver.
SizeToFit
Resize and move the recipient view size so he contains his child view
-(void) SizeToFit
Discuss
This method uses the Sizethatfits: method to determine the size. Subclasses need to rewrite sizethatfits: To calculate the correct size. The default implementation doesn't do anything.
Viewwithtag:
Returns a specific label for a view
-(UIView *) Viewwithtag: (Nsinteger) tag
Parameters
Tag
A label to search for in the view
return value
The view conforms to the label in the recipient hierarchy, and the recipient is also included in the search.
Common methods of UIView