uiviewcontroller 默认方法加载 view方法的 顺序
转:http://www.cnblogs.com/woainilsr/archive/2012/02/21/2361852.html
加载过程:
1,init,initWithNibName
2,- (void)loadView(用xib就不调用了)
3,- (void)viewDidLoad
4,- (void)viewWillAppear:(BOOL)animated;
5,- (void)viewDidAppear:(BOOL)animated;
卸载过程:
1,- (void)viewWillDisappear:(BOOL)animated;
2,- (void)viewDidDisappear:(BOOL)animated;
3,- (void)viewWillUnload;//iOS5.0添加
4,- (void)viewDidUnload;
5,- (void)dealloc;
PS: 当程序收到内存不足的警告后, 程序内存中的所有的UIViewController都将会收到didReceiveMemoryWarning调用消息. 目的是将当前不显示的UIViewController中的view释放掉(不会调用UIViewController的dealloc方法), 所以当该UIViewController再次显示的时候又要生成一次, 此时它会调用loadView-> viewDidLoad ->viewWillAppear等, 这时最容易造成内存泄漏!
- (void)didReceiveMemoryWarning;
- (void)viewWillUnload;//iOS5.0添加
- (void)viewDidUnload;