Skip to content

Commit 67ddb1a

Browse files
author
amao
committed
8012 年去掉针对 iOS7 的 hack 代码
1 parent 031de92 commit 67ddb1a

1 file changed

Lines changed: 1 addition & 13 deletions

File tree

M80AttributedLabel/M80AttributedLabel.m

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -687,19 +687,7 @@ - (CGSize)sizeThatFits:(CGSize)size
687687
{
688688
CFRelease(framesetter);
689689
}
690-
691-
//hack:
692-
//1.需要加上额外的一部分size,有些情况下计算出来的像素点并不是那么精准
693-
//2.iOS7 的 CTFramesetterSuggestFrameSizeWithConstraint s方法比较残,需要多加一部分 height
694-
//3.iOS7 多行中如果首行带有很多空格,会导致返回的 suggestionWidth 远小于真实 width ,那么多行情况下就是用传入的 width
695-
if (newSize.height < _fontHeight * 2) //单行
696-
{
697-
return CGSizeMake(ceilf(newSize.width) + 2.0, ceilf(newSize.height) + 4.0);
698-
}
699-
else
700-
{
701-
return CGSizeMake(size.width, ceilf(newSize.height) + 4.0);
702-
}
690+
return CGSizeMake(MIN(ceilf(newSize.width) + 1, size.width), MIN(ceilf(newSize.height) + 1, size.height));
703691
}
704692

705693

0 commit comments

Comments
 (0)