티스토리 뷰

macOS, iOS

[iOS] @IBDesignable, @IBInspectable

SweetDev 2019. 9. 24. 17:01

스토리보드에서 커스텀뷰를 형태 그대로 보고 싶을 때, @IBDesignable, @IBInsepctable 어노테이션을 사용하면 된다!!

 

1. @IBDesignable

 

@IBDesignable 

public class MyButton: UIButton {

 

이런식으로 쓰면 된당

 

2. @IBInspectable

 

 

@IBInspectable을 값 앞에 붙이면, 

storyboard에 출력해서 할당할 수 있게 된다!

 

https://gogorchg.tistory.com/entry/iOS-IBDesignable-IBInspectable-활용

'macOS, iOS' 카테고리의 다른 글

[iOS] KingFisher...  (0) 2019.09.26
[iOS] xib랑 viewcontroller랑 연결하는법!  (0) 2019.09.26
[iOS] xcode에 preview 기능이 있다...?  (0) 2019.09.24
[Swift] default parameter  (0) 2019.09.20
[iOS] textfield 키보드 내릴 때  (0) 2019.09.20
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함