7

I have a CATextLayer with multiline Text. The wrapped option is set to YES. But it doesn't wrap the text on the last line. If I add another line with \n and a space, the wrapping occurs (but this destroys the layout).

This only happens in iOS >= 8.3

Any ideas what could cause this?

Swissdude
  • 3,486
  • 3
  • 35
  • 68

2 Answers2

4

Something in CATextLayer has changed in iOS 8.3 which means that you now need to add 1px more to the height than you did before. If you were using CTFramesetterSuggestFrameSizeWithConstraints then this now totals to 2px additional height.

It's an odd breakage but there's not much that can be done about that.

Bo A
  • 3,144
  • 2
  • 33
  • 49
0

I've just made LabelKit project that does a CoreText drawn animation of the text. It supports animation of multiline text too, and keeps the benefits of layout constraints content sizing while animating.

CATextLayer makes CoreGraphics text drawing, and letters there a wider and are not being layout in multiline layer properly.

Eugene Dudnyk
  • 5,553
  • 1
  • 23
  • 48