Repository: incubator-weex Updated Branches: refs/heads/0.15-dev 59f54f9c7 -> d9f67fd74
* [ios] fix text compatible problem Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/7e83d1fa Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/7e83d1fa Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/7e83d1fa Branch: refs/heads/0.15-dev Commit: 7e83d1fa12b35da3bf65b94821bd8499516ed594 Parents: ba53cd4 Author: acton393 <zhangxing610...@gmail.com> Authored: Fri Jul 14 17:05:08 2017 +0800 Committer: acton393 <zhangxing610...@gmail.com> Committed: Fri Jul 14 17:05:08 2017 +0800 ---------------------------------------------------------------------- ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/7e83d1fa/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m index 7d873a1..e00a866 100644 --- a/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m +++ b/ios/sdk/WeexSDK/Sources/Component/WXTextComponent.m @@ -846,8 +846,9 @@ do {\ return CGSizeZero; } if (isnan(aWidth)) { - aWidth = [attributedStringCpy boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading context:nil].size.width; + aWidth = CGFLOAT_MAX; } + aWidth = [attributedStringCpy boundingRectWithSize:CGSizeMake(aWidth, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading context:nil].size.width; CTFramesetterRef ctframesetterRef = CTFramesetterCreateWithAttributedString((__bridge CFAttributedStringRef)(attributedStringCpy)); suggestSize = CTFramesetterSuggestFrameSizeWithConstraints(ctframesetterRef, CFRangeMake(0, 0), NULL, CGSizeMake(aWidth, MAXFLOAT), NULL); @@ -894,9 +895,9 @@ do {\ if(actualLineCount && actualLineCount < lineCount) { suggestSize.height = suggestSize.height * actualLineCount / lineCount; } - return suggestSize; + return CGSizeMake(aWidth, suggestSize.height); } - return CGSizeMake(!isnan(aWidth)? aWidth :suggestSize.width, totalHeight); + return CGSizeMake(aWidth, totalHeight); } static void WXTextGetRunsMaxMetric(CFArrayRef runs, CGFloat *xHeight, CGFloat *underlinePosition, CGFloat *lineThickness)