0
我找到了NSAttributedString的類別,它們返回包含給定寬度的屬性字符串本身的矩形的高度。不幸的是,樂器說有一個泄漏。你能告訴我它在哪裏嗎?類別中的核心文本泄漏
@interface NSAttributedString (Height)
- (CGFloat)boundingHeightForWidth:(CGFloat)inWidth;
@end
@implementation NSAttributedString (Height)
- (CGFloat)boundingHeightForWidth:(CGFloat)inWidth
{
CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((CFMutableAttributedStringRef)self);
CGSize suggestedSize = CTFramesetterSuggestFrameSizeWithConstraints(framesetter, CFRangeMake(0, 0), NULL, CGSizeMake(inWidth, CGFLOAT_MAX), NULL);
CFRelease(framesetter);
return suggestedSize.height ;
}
@end
http://stackoverflow.com/questions/16597378/core-text-memory-allocation-issue/17360516#17360516 – MoDJ