uikit——UIView——event

event

- (void)didAddSubview:(UIView *)subview;
- (void)willRemoveSubview:(UIView *)subview;

- (void)willMoveToSuperview:(nullable UIView *)newSuperview;
- (void)didMoveToSuperview;
- (void)willMoveToWindow:(nullable UIWindow *)newWindow;
- (void)didMoveToWindow;
解释:
  • 默认这些方法什么都不做,可override自定义
  • newSuperview可为nil,只要view.superview变化即可
  • newWindow可为nil,只要view.window变化即可

你可能感兴趣的:(uikit,event,subview,superview,window)