gpt4 book ai didi

iphone - UIViewController 的 View 框架和 navigationController.view.frame 之间的区别?

转载 作者:行者123 更新时间:2023-12-03 20:26:12 36 4
gpt4 key购买 nike

我有一个 UIViewController 派生类,它是 UINavigationController View Controller 的一部分。

View 是 UIViewController 的一部分,并且还可以访问 navigationController 属性。

那么有什么区别

self.navigationController.view.frame 

对比

self.view.frame

就 UIViewController 类而言?

最佳答案

navigationController 只是 UIViewController 上的一个方便的属性,它使您可以访问包含导航 Controller 的 View Controller (如果有的话)。由于 UINavigationController 扩展了 UIViewController,它也有一个 view 属性。请参阅 Getting Other Related View Controllers 的文档在 UIViewController 的类引用中,获取 UIViewController 可能具有的其他 View Controller 引用列表。

  • self.navigationController.view.frame 为您提供导航 Controller View 的框架
  • self.view.frame 为您提供 View Controller View 的框架

导航 Controller 的 View 框架比其任何容器 View Controller 的 View 框架都大,因为它包括导航栏和状态栏。

希望这有助于澄清问题!

关于iphone - UIViewController 的 View 框架和 navigationController.view.frame 之间的区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4951230/

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