【问题标题】:how do I add an image without getting the background of the UIButton class via Interface Builder?如何在不通过 Interface Builder 获取 UIButton 类的背景的情况下添加图像?
【发布时间】:2011-06-16 06:07:02
【问题描述】:

我不断得到 UIButton 类的白色背景,不能只是透明地添加图像

【问题讨论】:

  • 你现在在做什么?
  • 我通过 IB 制作了一个 UIButton(圆形 REct 按钮),它具有全白背景。然后我选择图像属性作为我想要的图像。图像出现了,但背景全是白色和丑陋的。我希望背景是透明的,或者只是图像的尺寸。
  • 您可能希望通过对您有帮助的接受(概述的复选标记)答案。这是支持社区、感谢提供有用答案的用户并鼓励其他用户在未来继续回答您的问题的好方法。

标签: ios ios4 interface-builder uibutton


【解决方案1】:

在 Interface Builder 中将按钮 Type 设置为 Custom 应该会有所帮助。

【讨论】:

    【解决方案2】:

    使用UIButtonTypeCustom 并改为设置backgroundImage

    【讨论】:

    • 从对象库中,如何添加 UIButtonTypeCustom?我应该将什么元素拖到 UIToolBar 上?
    • 使用UIButton,然后打开属性检查器。将读取Round Rect Button 的选项更改为Custom Button
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-20
    • 1970-01-01
    • 1970-01-01
    • 2023-04-04
    • 1970-01-01
    相关资源
    最近更新 更多