<i id='KrEqE'><tr id='KrEqE'><dt id='KrEqE'><q id='KrEqE'><span id='KrEqE'><b id='KrEqE'><form id='KrEqE'><ins id='KrEqE'></ins><ul id='KrEqE'></ul><sub id='KrEqE'></sub></form><legend id='KrEqE'></legend><bdo id='KrEqE'><pre id='KrEqE'><center id='KrEqE'></center></pre></bdo></b><th id='KrEqE'></th></span></q></dt></tr></i><div id='KrEqE'><tfoot id='KrEqE'></tfoot><dl id='KrEqE'><fieldset id='KrEqE'></fieldset></dl></div>
  • <legend id='KrEqE'><style id='KrEqE'><dir id='KrEqE'><q id='KrEqE'></q></dir></style></legend>

    <tfoot id='KrEqE'></tfoot>
  • <small id='KrEqE'></small><noframes id='KrEqE'>

      <bdo id='KrEqE'></bdo><ul id='KrEqE'></ul>

      1. 如何设置 UIButton 的标题文字颜色?

        时间:2023-07-08

              <tbody id='a403u'></tbody>
            <legend id='a403u'><style id='a403u'><dir id='a403u'><q id='a403u'></q></dir></style></legend>

            <tfoot id='a403u'></tfoot>

                <small id='a403u'></small><noframes id='a403u'>

                <i id='a403u'><tr id='a403u'><dt id='a403u'><q id='a403u'><span id='a403u'><b id='a403u'><form id='a403u'><ins id='a403u'></ins><ul id='a403u'></ul><sub id='a403u'></sub></form><legend id='a403u'></legend><bdo id='a403u'><pre id='a403u'><center id='a403u'></center></pre></bdo></b><th id='a403u'></th></span></q></dt></tr></i><div id='a403u'><tfoot id='a403u'></tfoot><dl id='a403u'><fieldset id='a403u'></fieldset></dl></div>

                • <bdo id='a403u'></bdo><ul id='a403u'></ul>
                  本文介绍了如何设置 UIButton 的标题文字颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我尝试更改按钮文本的颜色,但它仍然保持白色.

                  I tried changing the colors of the text for a button, but it's still staying white.

                  isbeauty = UIButton()
                  isbeauty.setTitle("Buy", forState: UIControlState.Normal)
                  isbeauty.titleLabel?.textColor = UIColorFromRGB("F21B3F")
                  isbeauty.titleLabel!.font = UIFont(name: "AppleSDGothicNeo-Thin" , size: 25)
                  isbeauty.backgroundColor = UIColor.clearColor()
                  isbeauty.layer.cornerRadius = 5
                  isbeauty.layer.borderWidth = 1
                  isbeauty.layer.borderColor = UIColorFromRGB("F21B3F").CGColor
                  isbeauty.frame = CGRectMake(300, 134, 55, 26)
                  isbeauty.addTarget(self,action: "first:", forControlEvents: UIControlEvents.TouchUpInside)
                  self.view.addSubview(isbeauty)
                  

                  我也尝试将其更改为红色、黑色、蓝色,但没有任何反应.

                  I also tried changing it the red, black, blue, but nothing is happening.

                  推荐答案

                  你必须使用 func setTitleColor(_ color: UIColor?, for state: UIControl.State)实际的标题文本.文档

                  You have to use func setTitleColor(_ color: UIColor?, for state: UIControl.State) the same way you set the actual title text. Docs

                  isbeauty.setTitleColor(UIColorFromRGB("F21B3F"), for: .normal)
                  

                  这篇关于如何设置 UIButton 的标题文字颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用 resizableImageWithCapInsets: image for button 仅适用于状态集,其他状 下一篇:如何在 UIButton 上仅添加 TOP 边框?

                  相关文章

                • <small id='wNaay'></small><noframes id='wNaay'>

                  • <bdo id='wNaay'></bdo><ul id='wNaay'></ul>

                  <tfoot id='wNaay'></tfoot>

                      <legend id='wNaay'><style id='wNaay'><dir id='wNaay'><q id='wNaay'></q></dir></style></legend>

                      <i id='wNaay'><tr id='wNaay'><dt id='wNaay'><q id='wNaay'><span id='wNaay'><b id='wNaay'><form id='wNaay'><ins id='wNaay'></ins><ul id='wNaay'></ul><sub id='wNaay'></sub></form><legend id='wNaay'></legend><bdo id='wNaay'><pre id='wNaay'><center id='wNaay'></center></pre></bdo></b><th id='wNaay'></th></span></q></dt></tr></i><div id='wNaay'><tfoot id='wNaay'></tfoot><dl id='wNaay'><fieldset id='wNaay'></fieldset></dl></div>