gpt4 book ai didi

ios - 有没有办法检测显示了多少模态视图 Controller ?

转载 作者:行者123 更新时间:2023-11-29 11:05:14 26 4
gpt4 key购买 nike

在 iOS 中,呈现一个 modalViewController 非常简单:

[self presentModalViewController:controller animated:YES];

或者:

[[[[[UIApplication sharedApplication] delegate] window] rootViewController] presentModalViewController:controller animated:YES];

modalViewController(例如 navigationController)中,您可以再次呈现一个 modalViewController。有没有办法检测显示了多少模态视图 Controller ?否则 Hook presentModalViewController:animated:dismissModalViewControllerAnimated: 会是个好主意吗?谢谢!

最佳答案

检查这个问题:

Is it possible to determine whether ViewController is presented as Modal?

您可以使用该代码“爬升”您的 View ,直到您找到一个不是模态视图 Controller 的 View 。喜欢:

while (isModal)
{
currentViewController = currentViewController.presentingViewController;

...
}

关于ios - 有没有办法检测显示了多少模态视图 Controller ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13947904/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com