[iOS] @IBInspectable
2024. 1. 6. 15:10
class CustomView: UIView{
@IBInspectable var borderWidth: CGFloat {
get{
return layer.borderWidth
}
set{
layer.borderWidth = newValue
}
}
@IBInspectable var borderColor: UIColor?{
get{
return UIColor(cgColor: layer.borderColor!)
}
set{
layer.borderColor = newValue?.cgColor
}
}
}
Storyboard로 이동해서 UIView 생성 합니다.
출처
iOS ) 왕초보를 위한 IBInspectable / IBDesignable 사용해보기
안녕하세요 :) Zedd입니다.쓰려고 한 글들은 많지만...저는 그날그날 땡기는 글들을 쓰는 편인데, 오늘은 갑자기 이게 생각나서...!!!ㅎㅎ처음에 이걸 봤을 때 엄청 신기했거든요!!이 글을 읽기전에
zeddios.tistory.com
728x90
'iOS > UIKit' 카테고리의 다른 글
[iOS] UICollectionViewCompositionalLayout (0) | 2024.03.09 |
---|---|
[iOS] UIScrollView (1) | 2024.03.09 |
[iOS] 키보드 처리 (0) | 2023.12.30 |
[iOS] 기종별로(iPhone, iPad) StoryBoard 구분하기 (1) | 2023.12.30 |
[iOS] 한 개의 ViewController에서 여러 개의 tableView 처리 방법 (0) | 2023.06.17 |