Skip to content

Commit dd69c05

Browse files
committed
Merge branch 'ios-bugfix-textweight-0.11-dev' of https://github.com/kfeagle/incubator-weex into 0.11-dev
This closes #12
2 parents ef0e462 + 7ec9dfb commit dd69c05

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

ios/sdk/WeexSDK/Sources/Utility/WXConvert.m

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -503,32 +503,32 @@ + (WXTextStyle)WXTextStyle:(id)value
503503

504504
+ (CGFloat)WXTextWeight:(id)value
505505
{
506-
if([value isKindOfClass:[NSString class]]){
507-
NSString *string = (NSString *)value;
508-
if ([string isEqualToString:@"normal"])
509-
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0:UIFontWeightRegular;
510-
else if ([string isEqualToString:@"bold"])
511-
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.4:UIFontWeightBold;
512-
else if ([string isEqualToString:@"100"])
513-
return WX_SYS_VERSION_LESS_THAN(@"8.2")?-0.8:UIFontWeightUltraLight;
514-
else if ([string isEqualToString:@"200"])
515-
return WX_SYS_VERSION_LESS_THAN(@"8.2")?-0.6:UIFontWeightThin;
516-
else if ([string isEqualToString:@"300"])
517-
return WX_SYS_VERSION_LESS_THAN(@"8.2")?-0.4:UIFontWeightLight;
518-
else if ([string isEqualToString:@"400"])
519-
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0:UIFontWeightRegular;
520-
else if ([string isEqualToString:@"500"])
521-
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.23:UIFontWeightMedium;
522-
else if ([string isEqualToString:@"600"])
523-
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.3:UIFontWeightSemibold;
524-
else if ([string isEqualToString:@"700"])
525-
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.4:UIFontWeightBold;
526-
else if ([string isEqualToString:@"800"])
527-
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.56:UIFontWeightHeavy;
528-
else if ([string isEqualToString:@"900"])
529-
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.62:UIFontWeightBlack;
530-
531-
}
506+
NSString *string = [WXConvert NSString:value];
507+
if (!string)
508+
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0:UIFontWeightRegular;
509+
else if ([string isEqualToString:@"normal"])
510+
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0:UIFontWeightRegular;
511+
else if ([string isEqualToString:@"bold"])
512+
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.4:UIFontWeightBold;
513+
else if ([string isEqualToString:@"100"])
514+
return WX_SYS_VERSION_LESS_THAN(@"8.2")?-0.8:UIFontWeightUltraLight;
515+
else if ([string isEqualToString:@"200"])
516+
return WX_SYS_VERSION_LESS_THAN(@"8.2")?-0.6:UIFontWeightThin;
517+
else if ([string isEqualToString:@"300"])
518+
return WX_SYS_VERSION_LESS_THAN(@"8.2")?-0.4:UIFontWeightLight;
519+
else if ([string isEqualToString:@"400"])
520+
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0:UIFontWeightRegular;
521+
else if ([string isEqualToString:@"500"])
522+
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.23:UIFontWeightMedium;
523+
else if ([string isEqualToString:@"600"])
524+
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.3:UIFontWeightSemibold;
525+
else if ([string isEqualToString:@"700"])
526+
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.4:UIFontWeightBold;
527+
else if ([string isEqualToString:@"800"])
528+
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.56:UIFontWeightHeavy;
529+
else if ([string isEqualToString:@"900"])
530+
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0.62:UIFontWeightBlack;
531+
532532
return WX_SYS_VERSION_LESS_THAN(@"8.2")?0:UIFontWeightRegular;
533533
}
534534

0 commit comments

Comments
 (0)