问题描述
当我使用标准显示模式且设备处于横向模式时,我的iPhone 6上的 UIMenuController
出现问题。在iPhone 6 Plus上,两种模式都存在问题。也许这取决于屏幕分辨率。
I have a problem with the UIMenuController
on my iPhone 6 when I use the standard display mode and device is in landscape mode. On iPhone 6 Plus the problem is in both modes. Maybe it's depends on screen resolution.
在这种情况下, UIMenuController
将被左右和/或右截断。似乎 UIMenuController
可以具有最大界限,就像手机处于纵向模式一样。
In that case, the UIMenuController
will be truncated left and/or right. It seems that the UIMenuController
can have maximum bounds as if the phone is in portrait mode.
参见 UIMenuController
截断(iPhone6横向原理图):
iPhone6风景
See UIMenuController
truncated (iPhone6 landscape schematic): http://imageshack.com/a/img631/8470/ozlaGe.jpg "iPhone6 landscape"
对我来说,这似乎是一个iOS8 + iPhone 6的错误。代码没有改变很长时间并且有效。
在缩放显示模式下, UIMenuController
将像所有其他iPhone / iPad上一样正确显示。 iOS7。
For me it seems like an iOS8+iPhone 6 bug. The code didn't change for a long time and worked.In zoomed display mode, UIMenuController
will be displayed correctly like on all other iPhones/iPads incl. iOS7.
... define UIMenuItems....
[self becomeFirstResponder]; // canBecomeFirstResponder returns YES;
UIMenuController *menu = [UIMenuController sharedMenuController];
[menu setMenuItems:items];
.. define frame...
[menu setTargetRect:frame inView:self];
[menu setMenuVisible:YES animated:YES];
修正:见Iliya Barenboim的评论
推荐答案
原因是你没有iPhone 6和iPhone 6+的启动图像。
The reason is that you didn't have launch images for iPhone 6 and iPhone 6+.
添加启动图像时遇到的另一件事是,使用资产目录执行此操作时会出现错误。我在我的项目中添加了静态启动图像,并按照此处的说明手动编辑了我的info.plist:。
One other thing that I ran into when adding the launch images, is that there is a bug when doing this with an asset catalog. I added static launch images to my project and manually edited my info.plist as described here: https://stackoverflow.com/a/25960203/378179.
这篇关于iPhone6(无显示缩放模式)UIMenuController被截断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!