码迷,mamicode.com
首页 > 其他好文 > 详细

UIViewController生命周期

时间:2015-07-12 23:15:47      阅读:130      评论:0      收藏:0      [点我收藏+]

标签:

#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

UIViewController生命周期

标签:

原文地址:http://www.cnblogs.com/lhp-1992/p/4641667.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!