<tfoot id='3YwSO'></tfoot><legend id='3YwSO'><style id='3YwSO'><dir id='3YwSO'><q id='3YwSO'></q></dir></style></legend>

  • <small id='3YwSO'></small><noframes id='3YwSO'>

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

      1. UIButton 标题左对齐问题 (iOS/Swift)

        时间:2023-07-08
        • <i id='K8K4R'><tr id='K8K4R'><dt id='K8K4R'><q id='K8K4R'><span id='K8K4R'><b id='K8K4R'><form id='K8K4R'><ins id='K8K4R'></ins><ul id='K8K4R'></ul><sub id='K8K4R'></sub></form><legend id='K8K4R'></legend><bdo id='K8K4R'><pre id='K8K4R'><center id='K8K4R'></center></pre></bdo></b><th id='K8K4R'></th></span></q></dt></tr></i><div id='K8K4R'><tfoot id='K8K4R'></tfoot><dl id='K8K4R'><fieldset id='K8K4R'></fieldset></dl></div>

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

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

                  <tbody id='K8K4R'></tbody>

                • <legend id='K8K4R'><style id='K8K4R'><dir id='K8K4R'><q id='K8K4R'></q></dir></style></legend>
                • <tfoot id='K8K4R'></tfoot>
                  本文介绍了UIButton 标题左对齐问题 (iOS/Swift)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在左对齐 UIButton 的文本时遇到问题.我也尝试将其更改为 .Right 但它仍然保持居中.我也试过 aButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 0) 而不是 aButton.titleLabel?.textAlignment = .Left但这也不会改变任何事情.是否有另一种方法可以以编程方式更改 UIButton 标题的对齐方式?

                  I'm having a problem left-aligning a UIButton's text. I also tried changing it to .Right but it still stays centered. I also tried aButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 0) instead of aButton.titleLabel?.textAlignment = .Left but that doesn't change anything either. Is there an alternative way to programmatically change the alignment of a UIButton title's?

                          allButtonViews = UIView(frame: CGRectMake(0, 44, 100, 100))
                          allButtonViews.backgroundColor = .redColor()
                  
                          let campusButton = UIButton(type: UIButtonType.System) as UIButton
                          aButton.frame = CGRectMake(0, 0, 300, 70)
                          aButton.setTitle("A", forState: .Normal)
                          aButton.titleLabel?.textColor = .blueColor()
                          aButton.titleLabel?.textAlignment = .Left
                          aButton.backgroundColor = .whiteColor()
                  
                          sortView.addSubview(aButton)
                          view.addSubview(allButtonViews)
                  

                  推荐答案

                  试试这个:

                  button.contentHorizontalAlignment = .left
                  

                  这篇关于UIButton 标题左对齐问题 (iOS/Swift)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:来自带有自定义图像的 UIButtons 的自定义 UIBarButtonItems - 是否可以使点击目标更大? 下一篇:如何在一个圆圈内对齐 UIButtons?

                  相关文章

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

                  • <bdo id='0NGbB'></bdo><ul id='0NGbB'></ul>

                  <tfoot id='0NGbB'></tfoot>
                    <legend id='0NGbB'><style id='0NGbB'><dir id='0NGbB'><q id='0NGbB'></q></dir></style></legend>

                      <small id='0NGbB'></small><noframes id='0NGbB'>