UIViewController生命周期及方法调用顺序

                                                        2016/1/25         00:03

UIViewController生命周期及方法调用顺序_第1张图片


#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(@"视图控制器被释放");
}


你可能感兴趣的:(UIViewController生命周期及方法调用顺序)