반응형
UILineBreakModeWordWrap은 더 이상 사용되지 않습니다.
내 코드는 다음과 같습니다.
CGSize s = [string sizeWithFont:[UIFont systemFontOfSize:20]
constrainedToSize:CGSizeMake(self.view.bounds.size.width - 40, CGFLOAT_MAX) // - 40 For cell padding
lineBreakMode:UILineBreakModeWordWrap];
UILinebBreakModeWordWrap이 iOS 6에서 더 이상 사용되지 않는다는 경고가 표시됩니다.
NSLineBreakByWordWrapping
iOS 6에서 사용해야합니다 .
코드를 보려면 다음을 시도하십시오.
NSString *string = @"bla";
CGSize s = [string sizeWithFont:[UIFont systemFontOfSize:20]
constrainedToSize:CGSizeMake(self.view.bounds.size.width - 40, CGFLOAT_MAX) // - 40 For cell padding
lineBreakMode:NSLineBreakByWordWrapping];
라벨의 예는 다음과 같습니다.
[label setLineBreakMode:NSLineBreakByWordWrapping];
대신에
label.lineBreakMode = UILineBreakModeWordWrap;
이전 버전과의 호환성을 유지하기 위해 다음과 같이 매크로를 만들 수 있습니다.
#ifdef __IPHONE_6_0
# define LINE_BREAK_WORD_WRAP NSLineBreakByWordWrapping
#else
# define LINE_BREAK_WORD_WRAP UILineBreakModeWordWrap
#endif
참고 URL : https://stackoverflow.com/questions/12914788/uilinebreakmodewordwrap-is-deprecated
반응형
'developer tip' 카테고리의 다른 글
x << 1 또는 x << 10 중 어느 것이 더 빠릅니까? (0) | 2020.09.23 |
---|---|
Python : tf-idf-cosine : 문서 유사성 찾기 (0) | 2020.09.23 |
주 함수에서 argc와 argv의 이름을 바꾸는 것이 안전합니까? (0) | 2020.09.23 |
(의사) 임의의 영숫자 문자열 생성 (0) | 2020.09.23 |
gem 설치 권한 문제 (0) | 2020.09.23 |