0
스토리 보드에서 라벨을 만들었으므로 이제 해당 라벨에 패딩을 추가하려고합니다. 클래스를 만들고 아래 두 가지 방법을 모두 시도했지만 아무 것도 작동하지 않습니다. 도와주세요.UILabel iOS Swift의 패딩
override func drawTextInRect(rect: CGRect) {
super.drawTextInRect(UIEdgeInsetsInsetRect(rect, UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 0)))
}
let padding = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10)
override func intrinsicContentSize() -> CGSize {
let superContentSize = super.intrinsicContentSize()
let width = superContentSize.width + padding.left + padding.right
let heigth = superContentSize.height + padding.top + padding.bottom
return CGSize(width: width, height: heigth)
}
나는 tableViewCell에서 레이블이, 내가이 어떻게 적용 할 수 있는가? 고관절. 감사 . –
는 uitableview의 cellForRowat 메서드에서 셀의 레이블에 동일한 것을 구현합니다. –