Skip to content

Commit eb6ab79

Browse files
committed
iOS 7 compatible when set font name with InterfaceBuilder:#404
1 parent 8330d7f commit eb6ab79

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

YYText/YYLabel.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ - (void)setFontName_:(NSString *)fontName {
12371237
} else if ([fontName.lowercaseString isEqualToString:@"system bold"]) {
12381238
font = [UIFont boldSystemFontOfSize:font.pointSize];
12391239
} else {
1240-
if ([self fontIsBold_:font] && ![fontName.lowercaseString containsString:@"bold"]) {
1240+
if ([self fontIsBold_:font] && ([fontName.lowercaseString rangeOfString:@"bold"].location == NSNotFound)) {
12411241
font = [UIFont fontWithName:fontName size:font.pointSize];
12421242
font = [self boldFont_:font];
12431243
} else {

YYText/YYTextView.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,7 +1795,7 @@ - (NSArray *)_localizedUndoStrings {
17951795
NSString *canonical = [NSLocale canonicalLocaleIdentifierFromString:preferred];
17961796
if (canonical.length == 0) canonical = @"en";
17971797
strings = dic[canonical];
1798-
if (!strings && [canonical containsString:@"_"]) {
1798+
if (!strings && ([canonical rangeOfString:@"_"].location != NSNotFound)) {
17991799
NSString *prefix = [canonical componentsSeparatedByString:@"_"].firstObject;
18001800
if (prefix.length) strings = dic[prefix];
18011801
}
@@ -3718,7 +3718,7 @@ - (void)setFontName_:(NSString *)fontName {
37183718
} else if ([fontName.lowercaseString isEqualToString:@"system bold"]) {
37193719
font = [UIFont boldSystemFontOfSize:font.pointSize];
37203720
} else {
3721-
if ([self fontIsBold_:font] && ![fontName.lowercaseString containsString:@"bold"]) {
3721+
if ([self fontIsBold_:font] && ([fontName.lowercaseString rangeOfString:@"bold"].location == NSNotFound)) {
37223722
font = [UIFont fontWithName:fontName size:font.pointSize];
37233723
font = [self boldFont_:font];
37243724
} else {
@@ -3758,7 +3758,7 @@ - (void)setPlaceholderFontName_:(NSString *)fontName {
37583758
} else if ([fontName.lowercaseString isEqualToString:@"system bold"]) {
37593759
font = [UIFont boldSystemFontOfSize:font.pointSize];
37603760
} else {
3761-
if ([self fontIsBold_:font] && ![fontName.lowercaseString containsString:@"bold"]) {
3761+
if ([self fontIsBold_:font] && ([fontName.lowercaseString rangeOfString:@"bold"].location == NSNotFound)) {
37623762
font = [UIFont fontWithName:fontName size:font.pointSize];
37633763
font = [self boldFont_:font];
37643764
} else {

0 commit comments

Comments
 (0)