[关闭]
@SanMao 2015-10-12T16:05:03.000000Z 字数 2412 阅读 1414

系统方法调用总结

知识补充


  1. +(void)load
  2. {
  3. }
  1. -(void)loadView
  2. {
  3. }
  1. - (void)viewDidLoad;
  2. // Called after the view has been loaded. For view controllers created in code, this is after -loadView. For view controllers unarchived from a nib, this is after the view is set.
  1. - (void)viewWillAppear:(BOOL)animated;
  2. // Called when the view is about to made visible. Default does nothing
  1. - (void)viewDidAppear:(BOOL)animated;
  2. // Called when the view has been fully transitioned onto the screen. Default does nothing
  1. - (void)viewWillDisappear:(BOOL)animated;
  2. // Called when the view is dismissed, covered or otherwise hidden. Default does nothing
  1. - (void)viewDidDisappear:(BOOL)animated;
  2. // Called after the view was dismissed, covered or otherwise hidden. Default does nothing
  1. + (void)initialize
  2. {
  3. }

几个强制更新方法的区别

setNeedsDisplay(异步执行)

- 自动调用drawRect方法来实现view的绘制,方便绘图

setNeedsLayout(异步执行)

- 默认调用layoutSubviews来实现view中subView的重新布局,方便出来数据

layoutIfNeeded

- 异步调用layoutIfNeeded刷新布局,不是立即刷新只是做一个刷新布局的标记,内部调用layoutSubviews
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注