标签:
//1.手势,viewcontroller 进入下一页
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
MCJViewController *mcjVC = [[MCJViewController alloc] init];
[self presentViewController:mcjVC animated:YES completion:nil];
}
// 生命周期内容
// 1.
- (instancetype)init
{
if (self = [super init]) {
}
return self;
}
// 2.
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor orangeColor];
}
// 3.
- (void)viewWillAppear:(BOOL)animated
{
NSLog(@"%s",__FUNCTION__);
}
// 4.
- (void)viewDidAppear:(BOOL)animated
{
NSLog(@"%s",__FUNCTION__);
}
// 5.
- (void)viewWillDisappear:(BOOL)animated
{
NSLog(@"%s",__FUNCTION__);
}
// 6.
- (void)viewDidDisappear:(BOOL)animated
{
NSLog(@"%s",__FUNCTION__);
}
// 7.
- (void)dealloc
{
NSLog(@"%s",__FUNCTION__);
}
// 手势,退出本页
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[self dismissViewControllerAnimated:YES completion:nil];
}
母传键老师课堂笔记 -----ViewController的生命周期
标签:
原文地址:http://www.cnblogs.com/fanwenzheIOS/p/4973554.html