gpt4 book ai didi

ios - 与父级不同,从 iMessage 应用程序呈现的 View Controller 被 iMessage 顶部栏覆盖

转载 作者:行者123 更新时间:2023-11-28 08:12:00 26 4
gpt4 key购买 nike

我注意到将工具栏放置在 iMessage 栏下方很困难,因为生成的 View Controller 似乎开始绘制在顶部 iMessage 栏所在的空间中。由于 iPhone 5s 的 iMessage 栏的高度为 44 像素,因此使用距顶部 64 的固定距离不起作用。

然后我意识到这只是呈现 View Controller 时的一个问题,并且第一个 View Controller 或 Root View Controller 实际上开始呈现在 iMessage 顶部栏下方。我想知道是否有任何一种方法可以检测高度,或者是否有一种方法可以使生成的 View Controller 应用与 iMessage 应用程序的根 Controller 类似的布局。

这里有一些显示问题的屏幕截图。请注意工具栏和顶部栏之间的小间隙。这是因为 iPhone 5s 的 iMessage 顶部栏高度较短。

iPhone 5S 显示差距

5s device with gap between top bar and nav bar

在 6s/更大的设备上,工具栏和顶部栏之间没有间隙:

6s device with no gap between top bar and nav bar

我编写了一个示例应用程序,以显示生成的 View Controller 开始在与 iMessage 顶部栏相同的位置绘制。

顶部约束小于 10 像素的初始/父 View Controller 。

Sample app showing that parent controller begins rendering below imessage top bar

粉红色按钮上顶部约束小于 10 像素的子项。

Sample app showing that spawned View controllers begins rendering at the same location as imessage top bar

示例 Storyboard的屏幕截图。

Storyboard showing VCs are similar distance from top

最佳答案

今天我遇到了几乎相同的问题,我从 deeplink 显示 ViewController 并弹出一些导航栏.. :)

为了解决这个问题,我在 ViewController 中嵌入了 NavigationController,并在 viewWillAppear 中隐藏了导航栏。

self.navigationController?.setNavigationBarHidden(true, animated: true)

希望这会有所帮助。
祝你一切顺利。

关于ios - 与父级不同,从 iMessage 应用程序呈现的 View Controller 被 iMessage 顶部栏覆盖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43479275/

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