zoukankan      html  css  js  c++  java
  • 母传键老师课堂笔记 -----ViewController的生命周期

    //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];

    }

  • 相关阅读:
    处理数据
    Vue--Vue常用指令及操作
    Vue--Vue实例
    ES6--解构赋值
    ES6--入门
    前端模块化开发
    Node.js--入门
    HTML5--canvas与svg的使用
    input整理
    移动端开发入门
  • 原文地址:https://www.cnblogs.com/fanwenzheIOS/p/4973554.html
Copyright © 2011-2022 走看看