UIViewController生命週期及方法調用順序

                                                        2016/1/25         00:03
app


#pragma mark - 加載視圖
- (void)loadView {
    
    [super loadView];
    
    NSLog(@"加載視圖");
}

#pragma mark - 視圖加載完成
- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    NSLog(@"視圖加載完成");
}

#pragma mark - 視圖將要顯示
- (void)viewWillAppear:(BOOL)animated {
    
    [super viewWillAppear:animated];

    NSLog(@"視圖將要顯示");
}


#pragma mark - 視圖已經顯示
- (void)viewDidAppear:(BOOL)animated {
    
    [super viewDidAppear:animated];
    
    NSLog(@"視圖已經顯示");
}

#pragma mark - 視圖將要消失
- (void)viewWillDisappear:(BOOL)animated {
    
    [super viewWillDisappear:animated];
    
    NSLog(@"視圖將要消失");
}

#pragma mark - 視圖已經消失
- (void)viewDidDisappear:(BOOL)animated {
    
    [super viewWillDisappear:animated];
    
    NSLog(@"視圖已經消失");
}

#pragma mark - 視圖死亡
- (void)dealloc {
    
    NSLog(@"視圖控制器被釋放");
}
spa

相關文章
相關標籤/搜索