0

When I set button.setTitle("string") the letter 'g' is missing a tail, like this:

enter image description here

Alexander
  • 9,737
  • 4
  • 53
  • 59
Sang Trần
  • 2,147
  • 4
  • 13
  • 20

1 Answers1

0

Please try this.

Create a subclass of UIButton and override layoutSubviews func

class customButton: UIButton {
    override func layoutSubviews() {
        super.layoutSubviews()
        if var titleFrame : CGRect = titleLabel?.frame{
            titleFrame.size = self.bounds.size
            titleFrame.origin = .zero
            self.titleLabel!.frame = titleFrame
            self.titleLabel!.textAlignment = .center
        }
    }
}

reference.

Hope this helps.

Community
  • 1
  • 1
Sree
  • 530
  • 1
  • 8
  • 20