-
Drawing and printing:
-
drawRect:
- Implement this method if your view draws custom content. If your view does not do any custom drawing, avoid overriding this method. -
drawRect:forViewPrintFormatter:
- Implement this method only if you want to draw your view’s content differently during printing.
-
-
Layout:
-
sizeThatFits:
- Implement this method if you want your view to have a different default size than it normally would during resizing operations. For example, you might use this method to prevent your view from shrinking to the point where subviews cannot be displayed correctly. -
layoutSubviews
- Implement this method if you need more precise control over the layout of your subviews than the autoresizing behaviors provide. -
didAddSubview:
,willRemoveSubview:
- Implement these methods as needed to track the additions and removals of subviews. -
willMoveToSuperview:
,didMoveToSuperview
- Implement these methods as needed to track the movement of the current view in your view hierarchy. -
willMoveToWindow:
,didMoveToWindow
- Implement these methods as needed to track the movement of your view to a different window.
-
-
Event Handling:
-
touchesBegan:withEvent:
,touchesMoved:withEvent:
,touchesEnded:withEvent:
,touchesCancelled:withEvent:
- Implement these methods if you need to handle touch events directly. (For gesture-based input, use gesture recognizers.)
-
UIVIEW drawing content和layout的概念
最新推荐文章于 2019-12-02 13:30:21 发布