【问题标题】:background image TextField doesn´t appear背景图像 TextField 没有出现
【发布时间】:2012-03-01 09:53:27
【问题描述】:

我有 XCode 4.2

在界面生成器中,我正在为我的 TextField 选择背景图像,但它只是没有出现。我为自定义按钮做了同样的事情并且效果很好。不知道我错过了什么。

愚蠢的问题,但我想不通。

【问题讨论】:

    标签: iphone ios image uitextfield textfield


    【解决方案1】:

    可能是以下之一... 如果文本字段被禁用或borderStyle 值设置为UITextBorderStyleRoundedRect 样式,则与文本字段关联的自定义背景图像将被忽略。

    【讨论】:

      【解决方案2】:

      与文本字段关联的自定义背景图像将可见。

       self.textfieldName.borderStyle =UITextBorderStyleNone;
      

      【讨论】:

        【解决方案3】:
        textfield.borderStyle =UITextBorderStyleNone;
        
        textfield.background=[UIImage imageNamed:@"txt2.jpg"];
        

        【讨论】:

          猜你喜欢
          • 2017-01-31
          • 2018-02-22
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2016-09-09
          • 1970-01-01
          • 1970-01-01
          • 2012-07-12
          相关资源
          最近更新 更多