Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 |
Tags
- iOS16
- IOS
- error
- 한글
- Git
- UIButton
- github
- appstore
- Code
- Firebase
- darkmode
- MacOS
- view
- 웹뷰
- Notification
- 개발자
- Swift
- Xcode
- mac
- Archive
- JPA
- Session
- rxswift
- 이미지
- Realm
- SwiftUI
- geofencing
- window
- FLUTTER
- Apple
Archives
- Today
- Total
목록UILabel (1)
EEYatHo 앱 깎는 이야기
Swift ) UILabel 줄 수 알아내기 - EEYatHo iOS
개발을 하다보면 Label 의 줄 수에 따라서 조건이 변하는 경우가 생기는데, 대부분의 경우 AutoLayout으로 해결하지만, 줄 수에 따라 분기해야하는 경우도 발생합니다. text와 font를 가지고 , 미리 줄의 수를 알 수 있는 방법이 있습니다. class Utilities { ... /* UILabel의 줄 수를 return 합니다. label : .text와 .font를 설정해준 채로 보내줘야합니다. labelWidth : 한 줄의 넓이입니다. */ class func lineNumber(label: UILabel, labelWidth: CGFloat) -> Int { let boundingRect = label.text!.boundingRect(with: .zero, options: [.us..
iOS, Swift
2021. 3. 24. 13:47