代码之家  ›  专栏  ›  技术社区  ›  esqew

iPhone SDK中的透明按钮

  •  3
  • esqew  · 技术社区  · 15 年前

    我正在尝试在我的iPhone应用程序中创建一个透明的按钮——创建一个复活节彩蛋。我该如何设置按钮为透明而不触摸alpha(当uibutton的alpha=0.0时,它不再响应触摸)?

    谢谢。:)

    3 回复  |  直到 15 年前
        1
  •  2
  •   Grant Paul    15 年前

    您可以将alpha设置为非常小的值。

    或者,您可以创建一个空白的、清晰的uiimage并使用自定义按钮样式,然后将其设置为按钮的图像。

        2
  •  14
  •   Aaron Ash    15 年前

    将按钮类型设置为uibuttontypecustom,它将没有样式。(因此,它应该是“不可见的”)。

        3
  •  -1
  •   Dustin Laine    14 年前

    试试这个

    var btnTest = Ti.UI.createButton({
        backgroundImage: 'sample.png',
        height: 24,
        width: 20,
        top:  10,
        left:10
    });