문제

I have a dynamic string with dynamic length. I use CATextlayer to draw it in a view. I set wrapped = YES, but I don't know how to check the number of line of CATextlayer in a view to set dynamic frame for another view. Please help me. Thanks.

도움이 되었습니까?

해결책

Use NSString's sizeWithFont:constrainedToSize:lineBreakMode:

[yourString sizeWithFont:fontHere constrainedToSize:CGSizeMake(fixedWidthForLayerTextHere, 999) lineBreakMode:UILineBreakModeWordWrap];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top