본문 바로가기

Develop/UIKit

[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

'Develop > UIKit' 카테고리의 다른 글

UIModalPresentationStyle  (0) 2024.11.17
[iOS] storyboard에서 UIButton Image 오른쪽에 배치하기  (0) 2024.06.09
[iOS] UITextField PlaceHolder  (0) 2024.03.24
[iOS] UICollectionViewCompositionalLayout  (0) 2024.03.09
[iOS] UIScrollView  (1) 2024.03.09