UIViewController生命周期

#import "DetailViewController.h"

 

@interface DetailViewController ()

 

@end

 

@implementation DetailViewController

 

#pragma mark - 视图控制器对象的初始化方法

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil

{

    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

    if (self) {

        // Custom initialization

        NSLog(@"%s", __FUNCTION__);

    }

    return self;

}

 

#pragma mark - 加载视图的方法

- (void)loadView {

    [super loadView];

    NSLog(@"%s", __FUNCTION__);

}

 

#pragma mark - 视图已经加载完成

- (void)viewDidLoad

{

    [super viewDidLoad];

// Do any additional setup after loading the view.

    NSLog(@"%s", __FUNCTION__);

}

 

#pragma mark - 实现---dismissButtonAction:方法

- (void)dismissButtonAction:(UIButton *) sender {

    // 调用模态的关闭的方法

    [self dismissViewControllerAnimated:YES completion:nil];

}

 

#pragma mark - 已经接收到内存警告

- (void)didReceiveMemoryWarning

{

    [super didReceiveMemoryWarning];

    // Dispose of any resources that can be recreated.

    NSLog(@"%s", __FUNCTION__);

}

 

#pragma mark - 视图将要出现

- (void)viewWillAppear:(BOOL)animated {

    [super viewWillAppear:animated];

    NSLog(@"%s", __FUNCTION__);

}

 

#pragma mark - 视图已经出现

- (void)viewDidAppear:(BOOL)animated {

    [super viewDidAppear:animated];

    NSLog(@"%s", __FUNCTION__);

}

 

#pragma mark - 视图将要消失

- (void)viewWillDisappear:(BOOL)animated {

    [super viewWillDisappear:animated];

    NSLog(@"%s", __FUNCTION__);

}

 

#pragma mark - 视图已经消失

- (void)viewDidDisappear:(BOOL)animated {

    [super viewDidDisappear:animated];

    NSLog(@"%s", __FUNCTION__);

}

 

#pragma mark - 已经被弃用的方法

- (void)viewDidUnload {

    [super viewDidUnload];

    NSLog(@"%s", __FUNCTION__);

}

 

#pragma mark - dealloc方法

- (void)dealloc {

    NSLog(@"%s", __FUNCTION__);

    [_dismissButton release], _dismissButton = nil;

    [super dealloc];

}

 

@end

posted @ 2015-07-12 22:17  程序猿大鹏  阅读(76)  评论(0编辑  收藏  举报