How to use NSString's sizeWithFont and drawInRect to workout how much of a string to draw

前端 未结 2 1084
我在风中等你
我在风中等你 2020-12-29 17:18

I\'m drawing multiple \'pages\' of imagery using a CGContext in the iOS. I\'ve used sizeWithFont and drawInRect combinations extensively in my app. What I need to do is spli

2条回答
  •  难免孤独
    2020-12-29 17:50

    The way I get around this problem is to split by line returns.

    NSArray * paragraphs = [text componentsSeparatedByString:@"\n"];
    

    You still have to do all the work to determine page breaks and alike but I have found this the best workaround so far.

提交回复
热议问题