UIVIEW drawing content和layout的概念

  • 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:


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章