本文介绍了UIToolbar 在 iPad2 上不透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这让我发疯了.

我的 iPAD 应用程序上有一个工具栏,其半透明属性设置为是".我正在我的故事板中这样做:

I have a toolbar on my iPAD application and its translucent property is set to 'YES'. I am doing this in my storyboard:

当我在 iPad Air 上运行时,一切看起来都不错.但是,如果我在 iPad 2 上运行,则工具栏不是半透明的.我在模拟器和实际设备上都遇到了同样的问题.

When I run on an iPad Air things look good. However if I run on an iPad 2 the toolbar is not translucent. I experience the same problem in the simulator and on an actual device.

这在不同版本的操作系统中也不是问题.无论我运行什么操作系统(iOS 7 或 iOS 8),IE 在 iPad 2 上都是错误的,但在 iPad Air 上是正确的.

This is also not a problem across different versions of the OS. IE no matter what OS I run (iOS 7 or iOS 8) its wrong on an iPad 2 but correct on an iPad Air.

为什么??????

我能做些什么来在这些设备上获得一致的 L&F?

Is there anything I can do to get a consistent L&F across these devices?

推荐答案

半透明 - 使用模糊 - 计算成本高.

Translucency - which uses blur - is computationally expensive.

如果您比较 iPad 2 和 iPad Air 之间的控制面板或通知菜单, - 您会发现 Apple 在低功率设备上禁用了半透明,因为它无法真正应付.

If you compare the control panel or notification menu between iPad 2 and iPad Air, - you will see that Apple has disabled translucency on the lower powered device as it can't really cope.

这适用于 iPad2、iPad3、iPad mini 以及一些较旧的 iPhone 和 iPod Touch.如果您过度使用这些效果,即使是功率更高的设备也会产生较差的效果.

That applies to iPad2, iPad3, iPad mini and maybe some older iPhones and iPod Touches. Even higher-powered devices can give poor results if you over-use these effects.

如果您需要完全一致的外观和感觉,则应避免使用利用半透明和模糊效果的属性.另一种选择是在不支持半透明的设备上使用视图 alpha、背景颜色和色调,以获得半透明的外观.

If you need a completely consistent look and feel, you should resist using properties that take advantage of translucency and blur effects. Another option is to play around with view alpha, background colour and tint to get a semi-tranparent look on devices that don't support translucency.

有关 UIVisualEffect 的设备支持的更多信息,这似乎与 UI 对象上的半透明"属性支持一致:

For more information on device support for UIVisualEffect, which seems to coincide with 'translucency' property support on UI objects:

检查设备是否支持模糊
检测设备是否正确显示 UIVisualEffectView?

这篇关于UIToolbar 在 iPad2 上不透明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 06:38