【问题标题】:How to disable the light that appears when touching a UIBarButtonItem?如何禁用触摸 UIBarButtonItem 时出现的灯光?
【发布时间】:2020-02-23 20:42:02
【问题描述】:

我有一个带有UIBarButtonItem 样式的工具栏:UIBarButtonItemStylePlain。 我想知道如何禁用触摸时出现的灯光?

UIButtonshowsTouchWhenHighlighted 属性,但 UIBarButtonItem 没有这样的东西你可能知道吗?

【问题讨论】:

  • iPhone 用户在按下工具栏按钮时会期待这样的闪光效果,我不建议您将其移除。

标签: iphone uibutton uibarbuttonitem


【解决方案1】:

在 Interface Builder 中,将 UIButton 拖到工具栏上。它将创建一个UIBarButtonItem,其中包含一个UIButton。将UIButton 的类型设置为自定义。然后您可以完全自定义外观。例如将文本颜色更改为白色,将背景颜色更改为透明,当然还要禁用突出显示。

【讨论】:

  • 我记得曾经有一个设置,但它似乎从 Xcode 4.x 的 InterfaceBuilder 中消失了。
【解决方案2】:

您还可以放入 UITextField 并使其不可编辑。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-09
    • 1970-01-01
    • 1970-01-01
    • 2017-04-15
    • 1970-01-01
    相关资源
    最近更新 更多