原因是 项目奖品详情页下面有用户评论区,用户评论内容长度不确定需要动态计算,
由于 iOS 8并没有 PingFangSC-Medium 字体,所以会报错
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]'
把 PingFangSC-Medium 换成 iOS8 支持的字体即可 ,例如 Helvetica
- (CGFloat)multiLineLableHeight {
if (_multiLineLableHeight < 1) {
// 文字的最大尺寸 距离屏幕左边40 右边30
CGSize maxSize = CGSizeMake([UIScreen mainScreen].bounds.size.width -30-92, MAXFLOAT);
// !!!计算文字的高度
CGFloat textH = [self.content boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont fontWithName:@"Helvetica" size:12]} context:nil].size.height; //
_multiLineLableHeight = textH + 30 + 40;
if (_multiLineLableHeight < 60) {
_multiLineLableHeight = 60;
}
}
return _multiLineLableHeight;
}