简体   繁体   English

如何在iOS8的横向模式下启用iMessages / FB Messenger中的键盘?

[英]How can one enable keyboard like in iMessages/FB Messenger in landscape mode at iOS8?

In my project I have textViews with associated input keyboard which has the strange look in landscape mode on iPhone 6 Plus under iOS8 as shown below: 在我的项目中,我有带有相关输入键盘的textViews ,它在iOS8下的iPhone 6 Plus上横向模式具有奇怪的外观,如下所示:

在此输入图像描述

It seems that it has different orientation internally sometimes. 它似乎有时在内部有不同的方向。

But in some cases keyboard rotates fine but still has white gaps during orientation change and other visible bugs: 但在某些情况下,键盘旋转正常,但在方向更改和其他可见错误时仍有白色间隙:

在此输入图像描述

and finally we have ordinary expanded landscape view: 最后我们有普通的扩展景观视图:

在此输入图像描述

The question is how one can get the extended keyboard without bugs as follows: 问题是如何获得没有错误的扩展键盘如下:

在此输入图像描述

The very important thing to do while migrating projects from xCode5.1 (and earlier) to xCode6 is to modify Info.plist file by adding Launch screen interface file base name key 很重要的一点,同时从迁移项目做到xCode5.1 (或更早),以xCode6是修改Info.plist通过添加文件Launch screen interface file base name关键

在此输入图像描述

You can event set it to empty string (usually it is a name of the Launch xib ). 您可以将事件设置为空字符串(通常它是Launch xib的名称)。 Without this simply line one will have all the problems presented at screenshots above. 如果没有这个简单的线路,将会在上面的屏幕截图中显示所有问题。

The absence of the Launch screen interface file base name results in working in compatibility mode with standard resolution of older devices. 缺少Launch screen interface file base name导致在兼容模式下使用旧设备的标准分辨率。 Let's run the following code in the project in each case 在每种情况下,让我们在项目中运行以下代码

NSLog(@"bounds = %@", NSStringFromCGRect(UIScreen.mainScreen.bounds));

With Launch xib one gets 使用Launch xib得到

bounds = {{0, 0}, {414, 736}} // for iPhone 6Plus

bounds = {{0, 0}, {375, 667}} // for iPhone 6

Without it one gets 没有它,一个人得到

bounds = {{0, 0}, {320, 568}}

So, the last case indeed is the compatibility mode. 所以,最后一种情况确实是兼容模式。

I found the same kind of problem. 我发现了同样的问题。 When I was allowing only 1 of my viewcontroller to rotate.As soon as I was going inside the screen I was enabling the screen rotation and while coming out of the screen I was disabling it.Every thing was working fine except the keyboard UI.So I searched many forums for a solution but didn't find out anything useful. 当我只允许我的一个视图控制器旋转时。当我进入屏幕时,我正在启用屏幕旋转,当我从屏幕出来时,我正在禁用它。除了键盘UI之外,每件事情都很好。所以我搜索了许多论坛的解决方案,但没有发现任何有用的东西。 Anyhow, I have tried to understand the pattern and found out that I was using viewDidDisappear instead of viewWillDisappear. 无论如何,我试图理解模式并发现我使用的是viewDidDisappear而不是viewWillDisappear。

Its important to disable the orientation before it goes another screen.Hope this helps. 重要的是在它进入另一个屏幕之前禁用方向。希望这有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM