새소식

iOS/AutoLayout

[iOS] UIButton titleLabel

  • -

 

 

storyboard에서 UIButton의 titleLabel에 접근하려면 기본 세팅이 위와 같이 되어 있어야 한다.

아래 코드로 작성한다.

let button = UIButton()

button.titleLabel?.text = "버튼" // Text
button.titleLabel?.font = .systemFont(ofSize: 19.0, weight: .bold) // Font
button.titleLabel?.textColor = .black // TextColor

 

 

출처

 

How to change font of UIButton with Swift

I am trying to change the font of a UIButton using Swift... myButton.font = UIFont(name: "...", 10) However .font is deprecated and I'm not sure how to change the font otherwise. Any suggestions?

stackoverflow.com

 

728x90

'iOS > AutoLayout' 카테고리의 다른 글

[iOS] storyboard에서 UIButton Image 오른쪽에 배치하기  (0) 2024.06.09
[AutoLayout] SafeArea보다 더 높이 출력  (0) 2022.10.12
[AutoLayout] Multiplier  (0) 2022.10.10
[AutoLayout] Align  (0) 2022.10.09
[AutoLayout] Constraints  (0) 2022.10.08
Contents

포스팅 주소를 복사했습니다

이 글이 도움이 되었다면 공감 부탁드립니다.