转换到键盘可见的模态视图控制器

发布于 2025-01-02 06:42:37 字数 191 浏览 0 评论 0原文

是否可以在键盘已经可见的情况下呈现我的模态视图控制器?目前,模式的文本视图在加载视图后立即成为第一响应者,这会导致键盘从底部弹出动画。

这是过渡的一半(它们的键盘也有动画)

我希望键盘已经处于模式上并成为其转变的一部分。有什么建议吗?

Is it possible to present my modal view controller with the keyboard already visible? Currently, the modal's text view becomes the first responder as soon as it's view is loaded, which causes the keyboard to animate coming up from the bottom.

This is halfway through the transition (they keyboard is animating as well)

I'd like the keyboard to already be on the modal and be a part of it's transition. Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

厌倦 2025-01-09 06:42:38

键盘是一个单独的 UIWindow 对象。它与视图控制器的视图不在同一视图层次结构中。要实现这一点,您必须深入研究键盘窗口的 UIApplicationwindows 属性,并将其默认动画替换为自定义动画。

The keyboard is a separate UIWindow object. It is not in the same view hierarchy as your view controller's view. To make this happen, you would have to dig around in the UIApplication's windows property for the keyboard window and replace its default animation with a custom animation.

囍笑 2025-01-09 06:42:38

您可以尝试将 becomeFirstResponder 代码放入 vieWillAppear 中,但这无论如何都不是“正确”的做法。

您可能需要用自定义动画替换实际的键盘动画,以强制它立即加载而不向上滚动。

You could try putting the becomeFirstResponder code in vieWillAppear, but that isn't the "right" thing to do anyway.

You will probably need to replace the actual keyboard animation with a custom animation to force it to load immediately and without scrolling up.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文