ios - 半透明为 false 时 UIToolBar 上的 Bar Tint

标签 ios objective-c swift uitoolbar

我尝试在 UIToolbar 上设置 Bar Tint Color(在 Interface Builder 中),该 translucent 设置为关闭。无论我选择什么颜色,工具栏在模拟器中总是白色的(它在 IB 中改变颜色)。我需要将 translucent 设置为 true 以使我的 UIToolbar 具有正确的 Bar Tint。在 Apple 文档中,我没有看到任何地方提到当 translucent 设置为 false 时 barTintColor 不工作。

谢谢

编辑

看起来这只是界面生成器中的问题,在代码中设置 Bar Tint Color 是有效的,任何人都可以确认吗?

最佳答案

来自文档

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIToolbar_Class/#//apple_ref/occ/instp/UIToolbar/translucent

If you set this property to NO on a toolbar with a translucent custom background image, the toolbar provides an opaque background for the image using black if the toolbar has UIBarStyleBlack style, white if the toolbar has UIBarStyleDefault, or the toolbar’s barTintColor if a custom value is defined.

关于ios - 半透明为 false 时 UIToolBar 上的 Bar Tint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31331012/

相关文章:

ios - CollectionView numberOfItemsInSection 变量

ios - 将子类与文本字段委托(delegate)一起使用

ios - arc4random:限制生成的随机数的值

ios - TableViewController 导致 TabBar 项目标题更改为导航栏标题

ios - 什么是操作系统状态?

objective-c - 架构 i386 clang 的重复符号

ios - NSArray 返回 NULL 值,即使计算并返回了正确数量的对象

ios - 无法让 Firebase 调用 observe/observeSingleEvent 回调

swift - 属性更改时的动画 View SwiftUI

swift - socket 不能连接到重复的内容