When I set button.setTitle("string")
the letter 'g' is missing a tail, like this:
Asked
Active
Viewed 101 times
0
-
have you set the button title programmatically or through IB ? – Sree Mar 22 '17 at 04:55
-
I set the title in swift file, not in story board :( – Sang Trần Mar 22 '17 at 04:57
-
please paste the code you used to set the title – Sree Mar 22 '17 at 04:59
-
self.routeButton.setTitle(NSLocalizedString("search_route", comment: "ルート検索"), for: .normal) – Sang Trần Mar 22 '17 at 05:25
-
routeButton is UIButton or your custom button? – Nguyen Hoan Mar 22 '17 at 06:05
-
@Hoan it was created in story board – Sang Trần Mar 22 '17 at 06:40
1 Answers
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
}
}
}
Hope this helps.