1
UILabel의 프레임 크기에 맞도록 UIFont 크기를 자동 크기 조정하는 다중 행 UILabel을 사용할 수 있습니까? 그렇지 않다면 이것을 달성하는 가장 좋은 방법은 무엇입니까? 나는 UILabel/UITextView의 프레임 크기를 조정하고 싶지 않습니다. 지금까지 내가 이런 식으로 해왔 :여러 줄 자동 크기 조정 텍스트 UILabel
int currentFontSize = 18;
UIFont *currentFont = [UIFont fontWithName:kProximaNovaBold size:currentFontSize];
CGSize storyTitleSize = [storyTitle sizeWithFont:currentFont constrainedToSize:self.newsfeedStoryTitle_.frameSize];
while (storyTitleSize.height >= self.newsfeedStoryTitle_.frameHeight){
currentFontSize--;
currentFont = [UIFont fontWithName:kProximaNovaBold size:currentFontSize];
storyTitleSize = [storyTitle sizeWithFont:currentFont constrainedToSize:self.newsfeedStoryTitle_.frameSize];
}
[self.newsfeedStoryTitle_ setFont:currentFont];
[self.newsfeedStoryTitle_ setText:storyTitle];