美文网首页iOS技术
iOS页面加载生命周期

iOS页面加载生命周期

作者: wxkkkkk | 来源:发表于2017-07-18 10:56 被阅读0次

    SecondViewController push ThirdViewController

    SecondViewController push  ThirdViewController的方法顺序
    ThirdViewController---[ThirdViewController init]
    ThirdViewController---[ThirdViewController loadView]
    ThirdViewController---[ThirdViewController viewDidLoad]
    SecondViewController---[SecondViewController viewWillDisappear:]
    ThirdViewController---[ThirdViewController viewWillAppear:]
    SecondViewController---[SecondViewController viewDidDisappear:]
    ThirdViewController---[ThirdViewController viewDidAppear:]
    

    ThirdViewController pop SecondViewController

    ThirdViewController pop SecondViewController的方法顺序
    ThirdViewController---[ThirdViewController viewWillDisappear:]
    SecondViewController---[SecondViewController viewWillAppear:]
    ThirdViewController---[ThirdViewController viewDidDisappear:]
    SecondViewController---[SecondViewController viewDidAppear:]
    ThirdViewController---[ThirdViewController dealloc]
    

    ThirdViewController presentViewController FourthViewController

    ThirdViewController---[ThirdViewController viewWillDisappear:]
    FourthViewController---[FourthViewController viewWillAppear:]
    FourthViewController---[FourthViewController viewDidAppear:]
    ThirdViewController---[ThirdViewController viewDidDisappear:]
    

    FourthViewController dismissViewControllerAnimated ThirdViewController

    FourthViewController---[FourthViewController viewWillDisappear:]
    ThirdViewController---[ThirdViewController viewWillAppear:]
    ThirdViewController---[ThirdViewController viewDidAppear:]
    FourthViewController---[FourthViewController viewDidDisappear:]
    FourthViewController---[FourthViewController dealloc]
    

    相关方法
    1、 alloc            创建对象,分配空间
    2、 init             初始化对象,初始化数据
    3、loadView          加载视图
    4、viewDidLoad       载入完成
    5、viewWillAppear    视图将出现在屏幕
    6、viewDidAppear     视图已在屏幕上渲染完成
    1、viewWillDisappear 视图将被从屏幕上移除之
    2、viewDidDisappear  视图已经被从屏幕上移除
    3、dealloc           视图被销毁
    
    

    相关文章

      网友评论

        本文标题:iOS页面加载生命周期

        本文链接:https://www.haomeiwen.com/subject/zvahhxtx.html