- (void)updateConstraints NS_AVAILABLE_IOS(6_0) NS_REQUIRES_SUPER;
什麼時候觸發以下所示:oop
initWithFrame時候調用,可是要求重寫如下方法,並返回YES。佈局
+ (BOOL)requiresConstraintBasedLayout NS_AVAILABLE_IOS(6_0);
標記爲須要更新,下次drawing cycle自動調用。當約束改變時,下次render loop還會自動調用layoutSubviews(佈局)ui
- (void)setNeedsUpdateConstraints NS_AVAILABLE_IOS(6_0);
若是有須要更新的標記,當即調用。當約束改變時,下次render loop還會自動調用layoutSubviews(佈局)atom
- (void)updateConstraintsIfNeeded NS_AVAILABLE_IOS(6_0);
- (void)layoutSubviews;
什麼時候觸發以下所示:code
initWithFrame時候調用,可是rect的值不能爲CGRectZero。it
- (instancetype)initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER;
標記爲須要佈局,下次drawing cycle自動調用。class
- (void)setNeedsLayout;
若是有須要佈局的標記,當即調用。require
- (void)layoutIfNeeded;
本身的frame發生改變時,約束也會致使frame改變。sed
@property(nonatomic) CGRect frame;
添加子視圖或者子視圖frame改變時,約束也會致使frame改變。渲染
- (void)drawRect:(CGRect)rect;
什麼時候觸發以下所示:
initWithFrame時候調用,可是rect的值不能爲CGRectZero。
- (instancetype)initWithFrame:(CGRect)frame NS_DESIGNATED_INITIALIZER;
標記爲須要顯示,下次drawing cycle自動調用。
- (void)setNeedsDisplay;