• <tfoot id='hwYMV'></tfoot>
      <legend id='hwYMV'><style id='hwYMV'><dir id='hwYMV'><q id='hwYMV'></q></dir></style></legend>

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

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

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

        如何在 Swift 中为状态设置属性标题颜色

        How do you set an Attributed Title Color for State in Swift(如何在 Swift 中为状态设置属性标题颜色)
      1. <tfoot id='P4VsR'></tfoot>

      2. <small id='P4VsR'></small><noframes id='P4VsR'>

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

              <bdo id='P4VsR'></bdo><ul id='P4VsR'></ul>
            • <legend id='P4VsR'><style id='P4VsR'><dir id='P4VsR'><q id='P4VsR'></q></dir></style></legend>

                <tbody id='P4VsR'></tbody>
                • 本文介绍了如何在 Swift 中为状态设置属性标题颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我可以为 UIControlState 设置 attributedTitle,但是如何为 UIControlState 设置属性标题的颜色?

                  I'm able to set the attributedTitle for a UIControlState, but how would I set the attributed title's color for a UIControlState?

                  推荐答案

                  // create the button
                  let button = UIButton(frame: CGRect(x: 0, y: 0, width: 100, height: 50))
                  button.backgroundColor = UIColor.yellowColor()
                  
                  // set the attributed title for different states
                  
                  // .Selected
                  let mySelectedAttributedTitle = NSAttributedString(string: "Click Here",
                      attributes: [NSForegroundColorAttributeName : UIColor.greenColor()])
                  button.setAttributedTitle(mySelectedAttributedTitle, forState: .Selected)
                  
                  // .Normal
                  let myNormalAttributedTitle = NSAttributedString(string: "Click Here",
                      attributes: [NSForegroundColorAttributeName : UIColor.blueColor()])
                  button.setAttributedTitle(myNormalAttributedTitle, forState: .Normal)
                  

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

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  UIButton title text color(UIButton 标题文本颜色)
                  Stretch background image for UIButton(为 UIButton 拉伸背景图像)
                  Using Tint color on UIImageView(在 UIImageView 上使用 Tint 颜色)
                  How can I change UIButton title color?(如何更改 UIButton 标题颜色?)
                  iPhone UIButton - image position(iPhone UIButton - 图像位置)
                  UIButton remove all target-actions(UIButton 删除所有目标动作)

                    1. <legend id='lFmu7'><style id='lFmu7'><dir id='lFmu7'><q id='lFmu7'></q></dir></style></legend>

                            <tbody id='lFmu7'></tbody>

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

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

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