NSContreteAttributedString:initWithString:崩溃

时间:2015-11-04 02:58:46

标签: ios crash nsattributedstring

我想知道可能的原因是什么? mAutoCommentLabel.text是nil还是cellFont是nil?

UIFont* cellFont = mAutoCommentLabel.font;    
NSAttributedString *attrStr = [[NSAttributedString alloc] initWithString:mAutoCommentLabel.text attributes:@{NSFontAttributeName: cellFont}];

CGRect rect =
[attrStr boundingRectWithSize:CGSizeMake(withWidth, CGFLOAT_MAX)
                             options:(NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading)
                             context:nil];

int commentHeight = rect.size.height;

来自应用商店的崩溃日志继承人: enter image description here

0 个答案:

没有答案