iOS/iOS

[iOS] UIButton

물복딱복준복 2023. 1. 23. 14:15
var button: UIButton = UIButton()

// 버튼의 타이틀 변경
button.setTitle("my text here", forState: .nomal)

// 버튼의 타이틀 색상 변경
button.setTitleColor(color: UIColor?, for: UIControl.State)

// 버튼의 타이틀 폰트
button.titleLabel?.font = UIFont

// 버튼 동작 여부
button.isEnabled = Bool

// 버튼의 백그라운드 색상 변경
button.backgroundColor = UIColor

// 버튼의 이미지 설정
button.setImage(image: UIImage?, for: UIContorl.State)

// 버튼의 코너 설정
button.layer.cornerRadius = CGFloat
button.clipsToBounds = true

// 버튼의 border설정
button.layer.borderWidth = CGFloat
button.layer.borderColor = CGColor