闻道丶iOS(尝鲜版)iOS Developer

iOS开发-UIViewController转场及状态

2017-04-13  本文已影响132人  Huangbaoqin

转场的方法

//push方法转场
[self.navigationController pushViewController:[ZCResultViewController new] animated:YES];//push
[self.navigationController popViewControllerAnimated:YES];//返回
//modal方法转场
[self presentViewController:[ZCResultViewController new] animated:YES completion:nil];//present
[self dismissViewControllerAnimated:YES completion:nil];//返回

UIViewController状态

- (void)loadView {
    [super loadView];
}

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidDisappear:animated];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

注意 : (loadView方法) If you use Interface Builder to create your views and initialize the view controller, you must not override this method.

转场过程对状态的影响

  1. 从firstVC转场到resultVC的过程,依次调用
  1. 从resultVC转场到firstVC的过程,依次调用

说明 : Disappear(Appear)过程无转场动画的情况下,Will和Did方法之间几乎是同时调用。在有转场动画的情况下,Will和Did方法的调用时间相差0.6秒左右

上一篇 下一篇

猜你喜欢

热点阅读