iOS swift UIButtonConfiguration
iOS 15+ 부터 새로 생김
버튼안에 이미지(아이콘) + title 같이 넣고 싶은 경우 참조! 진짜 잘 쓴 글
디자이너로부터 받은 이미지 크기가 일정하지 않아서 어떤건 크고 어떤건 작았으나, (때로는 24x24, 48x48)...등
아래 글을 보고 이미지 크기를 동일하게 만들 수 있었다.
내 경우 앱런칭 프로젝트에서 MemoVC -> 버튼들 참조
lazy var othersBtn: UIButton = {
let view = UIButton()
var config = UIButton.Configuration.filled()
config.title = "기타"
config.baseForegroundColor = UIColor.black
config.image = UIImage(named: "others")
config.imagePadding = 4
config.baseBackgroundColor = UIColor(rgb: 0xE4E8EB)
config.contentInsets = NSDirectionalEdgeInsets.init(top: 4, leading: 4, bottom: 4, trailing: 4)
view.configuration = config
view.imageView?.contentMode = .scaleToFill
view.titleLabel?.font = UIFont(name: "Times New Roman", size: 15)
return view
}()
https://gyuios.tistory.com/126
Button Image넣었을 때 크게
https://intrepidgeeks.com/tutorial/ios-use-sfsymbol-to-resize-the-button-of-the-specified-ui-image
https://dominoc925.blogspot.com/2016/01/ios-uibuttons-image-aspect-fit-mode.html
'iOS > iOS Swift 개발 일기' 카테고리의 다른 글
iOS swift 키보드 올리기/내리기 (0) | 2022.10.02 |
---|---|
iOS swift TabBar Delegate (0) | 2022.10.02 |
iOS swift tableview 줄 없애기, 스크롤 색상 없애기 (0) | 2022.09.30 |
iOS swift UITextField/UITextView 글자 수 제한 (0) | 2022.09.30 |
iOS swift textfield/ textView return key(enter) keyboard down 키보드 내리기 (0) | 2022.09.30 |