我正在使用UITextView
和NSAttributedString
创建一个阅读器应用程序,我需要将整个attributedString拆分为较小数量的属性字符串,以启用页面概念。
我有计算给定属性字符串的帧大小的方法。
CGRect rect = [attrString boundingRectWithSize:CGSizeMake(768, 10000) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading context:nil];
但我需要获取(768,1024) ContentSize的attributeString。
我用过这个,但是attributedStrings没有正确划分,因为它包含NSTextAttachment
和HTML
stings。
CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)delegate.attributedString);
如何计算?而且它需要速度快,需要占用少量的内存。
https://stackoverflow.com/questions/29644538
复制相似问题