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

    <tfoot id='uijOb'></tfoot>

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

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

        在情节提要中更改 UIButton BorderColor

        时间:2023-07-08

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

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

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

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

                    <tbody id='q08fY'></tbody>
                  本文介绍了在情节提要中更改 UIButton BorderColor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在用户定义的运行时属性中为 UIbutton 设置 CornerRadius 和 BorderWidth.在不添加 layer.borderColor 的情况下,它可以正常工作并以黑色显示边框.但是当添加 layer.borderColor 不起作用(不显示边框).

                  I Set CornerRadius and BorderWidth for UIbutton in User Defined Runtime Attributes. Without adding layer.borderColor it works Well and Display border in black color. But when add layer.borderColor does not work(does not show border).

                  推荐答案

                  对于 Swift:

                  斯威夫特 3:

                  extension UIView {
                  
                      @IBInspectable var cornerRadius: CGFloat {
                          get {
                              return layer.cornerRadius
                          }
                          set {
                              layer.cornerRadius = newValue
                              layer.masksToBounds = newValue > 0
                          }
                      }
                  
                      @IBInspectable var borderWidth: CGFloat {
                          get {
                              return layer.borderWidth
                          }
                          set {
                              layer.borderWidth = newValue
                          }
                      }
                  
                      @IBInspectable var borderColor: UIColor? {
                          get {
                              return UIColor(cgColor: layer.borderColor!)
                          }
                          set {
                              layer.borderColor = newValue?.cgColor
                          }
                      }
                  }
                  

                  斯威夫特 2.2:

                  extension UIView {
                  
                      @IBInspectable var cornerRadius: CGFloat {
                          get {
                              return layer.cornerRadius
                          }
                          set {
                              layer.cornerRadius = newValue
                              layer.masksToBounds = newValue > 0
                          }
                      }
                  
                      @IBInspectable var borderWidth: CGFloat {
                          get {
                              return layer.borderWidth
                          }
                          set {
                              layer.borderWidth = newValue
                          }
                      }
                  
                      @IBInspectable var borderColor: UIColor? {
                          get {
                              return UIColor(CGColor: layer.borderColor!)
                          }
                          set {
                              layer.borderColor = newValue?.CGColor
                          }
                      }
                  }
                  

                  这篇关于在情节提要中更改 UIButton BorderColor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:UIButton 底部阴影 下一篇:UITableViewCell 中的 UIButton

                  相关文章

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

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

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

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