Pregunta

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.

¿Fue útil?

Solución

Use NSString's sizeWithFont:constrainedToSize:lineBreakMode:

[yourString sizeWithFont:fontHere constrainedToSize:CGSizeMake(fixedWidthForLayerTextHere, 999) lineBreakMode:UILineBreakModeWordWrap];
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top