呈现的视图控制器如何知道它是否正在呈现动画?

时间:2017-05-27 05:43:36

标签: ios swift uiviewcontroller

presentedVC如何知道它是否出现:

present(presentedVC, animated: true, completion: nil)

或通过:

present(presentedVC, animated: false, completion: nil)

1 个答案:

答案 0 :(得分:0)

您可以在呈现的视图控制器中取一个标志(bool类型的变量),并在呈现该视图控制器之前将其设置为yes或no!并且你可以在你呈现的viewcontroller中到处使用那个标志!就是这样!

例如,

TestViewController *tvc = [[TestViewController alloc]initWithNibName:@"TestViewController" bundle:nil];

tvc.isAnimated = NO;

[self presentViewController:tvc animated:NO completion:nil];

斯威夫特:

    let nvc = NewViewController()
    nvc.isAnimated = false
    self.present(nvc, animated: false, completion: nil)