Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
변경된점
lineHeight 설정해결
NSAttributedString을 UILabel에 사용할 때, NSParagraphStyle을 통해 lineHeight설정시 예상치 못한 문제가 발생했다.
lineHeight의 경우 베이스라인과 베이스라인 사이의 간격이다. 문제는 첫번째 라인은 상위 베이스 라인이 없음에도 지정한 lineHeight만큼의 여백이 생긴다.
따라서 라벨의 텍스트가 중앙에 배치되지 못하고 다소 아래로 설정되게된다.
이를 해결하는 방법은 baseLine Offset을 직접수정해주는 것이다.
font를 통해 lineHeight를 도출한다. (UIFont의 lineHeight는 모든 문자가 적절하게 표현되는 길이로 산정된다.)
그리고 라벨의 lineHeight에
서 앞서 도출한 값(폰트의 lineHeight)을 빼고 2로나눈 값만큼 offset을 조정해준다.