首页 > 其他 > 详细

UIViewController生命周期

时间:2015-07-12 23:13:53      阅读:318      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!