33
33
#define kBITLineBreakWordWrapTextWidthScalingFactor (M_PI / M_E)
34
34
35
35
#pragma clang diagnostic push
36
- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
37
36
#pragma clang diagnostic ignored "-Wunused-variable"
38
37
#pragma clang diagnostic ignored "-Wunused-parameter"
39
38
#pragma clang diagnostic ignored "-Wcast-qual"
@@ -882,9 +881,9 @@ - (void)drawBackground:(CTFrameRef)frame
882
881
NSDictionary *attributes = (__bridge NSDictionary *)CTRunGetAttributes ((__bridge CTRunRef) glyphRun);
883
882
CGColorRef strokeColor = CGColorRefFromColor ([attributes objectForKey: kBITBackgroundStrokeColorAttributeName ]);
884
883
CGColorRef fillColor = CGColorRefFromColor ([attributes objectForKey: kBITBackgroundFillColorAttributeName ]);
885
- UIEdgeInsets fillPadding = [[attributes objectForKey: kBITBackgroundFillPaddingAttributeName ] UIEdgeInsetsValue ];
886
- CGFloat cornerRadius = [[attributes objectForKey: kBITBackgroundCornerRadiusAttributeName ] floatValue ];
887
- CGFloat lineWidth = [[attributes objectForKey: kBITBackgroundLineWidthAttributeName ] floatValue ];
884
+ UIEdgeInsets fillPadding = [( NSValue *) [attributes objectForKey: kBITBackgroundFillPaddingAttributeName ] UIEdgeInsetsValue ];
885
+ CGFloat cornerRadius = [( NSNumber *) [attributes objectForKey: kBITBackgroundCornerRadiusAttributeName ] floatValue ];
886
+ CGFloat lineWidth = [( NSNumber *) [attributes objectForKey: kBITBackgroundLineWidthAttributeName ] floatValue ];
888
887
889
888
if (strokeColor || fillColor) {
890
889
CGRect runBounds = CGRectZero ;
@@ -951,8 +950,8 @@ - (void)drawStrike:(CTFrameRef)frame
951
950
952
951
for (id glyphRun in (__bridge NSArray *)CTLineGetGlyphRuns ((__bridge CTLineRef)line)) {
953
952
NSDictionary *attributes = (__bridge NSDictionary *)CTRunGetAttributes ((__bridge CTRunRef) glyphRun);
954
- BOOL strikeOut = [[attributes objectForKey: kBITStrikeOutAttributeName ] boolValue ];
955
- NSInteger superscriptStyle = [[attributes objectForKey: (id )kCTSuperscriptAttributeName ] integerValue ];
953
+ BOOL strikeOut = [( NSNumber *) [attributes objectForKey: kBITStrikeOutAttributeName ] boolValue ];
954
+ NSInteger superscriptStyle = [( NSNumber *) [attributes objectForKey: (id )kCTSuperscriptAttributeName ] integerValue ];
956
955
957
956
if (strikeOut) {
958
957
CGRect runBounds = CGRectZero ;
@@ -1019,9 +1018,9 @@ - (void)drawStrike:(CTFrameRef)frame
1019
1018
#pragma mark - BITAttributedLabel
1020
1019
1021
1020
- (void )setText : (id )text {
1022
- NSParameterAssert (!text || [text isKindOfClass: [NSAttributedString class ]] || [text isKindOfClass: [NSString class ]]);
1021
+ NSParameterAssert (!text || [( NSObject *) text isKindOfClass: [NSAttributedString class ]] || [( NSObject *) text isKindOfClass: [NSString class ]]);
1023
1022
1024
- if ([text isKindOfClass: [NSString class ]]) {
1023
+ if ([( NSObject *) text isKindOfClass: [NSString class ]]) {
1025
1024
[self setText: text afterInheritingLabelAttributesAndConfiguringWithBlock: nil ];
1026
1025
return ;
1027
1026
}
@@ -1051,7 +1050,7 @@ - (void)setText:(id)text {
1051
1050
1052
1051
[self .attributedText enumerateAttribute: NSLinkAttributeName inRange: NSMakeRange (0 , self .attributedText.length) options: 0 usingBlock: ^(id value, NSRange range, __unused BOOL *stop) {
1053
1052
if (value) {
1054
- NSURL *URL = [value isKindOfClass: [NSString class ]] ? [NSURL URLWithString: value] : value;
1053
+ NSURL *URL = [( NSObject *) value isKindOfClass: [NSString class ]] ? [NSURL URLWithString: value] : value;
1055
1054
[self addLinkToURL: URL withRange: range];
1056
1055
}
1057
1056
}];
@@ -1061,7 +1060,7 @@ - (void)setText:(id)text
1061
1060
afterInheritingLabelAttributesAndConfiguringWithBlock : (NSMutableAttributedString * (^)(NSMutableAttributedString *mutableAttributedString))block
1062
1061
{
1063
1062
NSMutableAttributedString *mutableAttributedString = nil ;
1064
- if ([text isKindOfClass: [NSString class ]]) {
1063
+ if ([( NSObject *) text isKindOfClass: [NSString class ]]) {
1065
1064
mutableAttributedString = [[NSMutableAttributedString alloc ] initWithString: text attributes: NSAttributedStringAttributesFromLabel(self )];
1066
1065
} else {
1067
1066
mutableAttributedString = [[NSMutableAttributedString alloc ] initWithAttributedString: text];
@@ -1299,7 +1298,7 @@ - (NSArray *)accessibilityElements {
1299
1298
continue ;
1300
1299
}
1301
1300
1302
- NSString *sourceText = [self .text isKindOfClass: [NSString class ]] ? self.text : [(NSAttributedString *)self .text string ];
1301
+ NSString *sourceText = [( NSObject *) self .text isKindOfClass: [NSString class ]] ? self.text : [(NSAttributedString *)self .text string ];
1303
1302
1304
1303
NSString *accessibilityLabel = [sourceText substringWithRange: link .result.range];
1305
1304
NSString *accessibilityValue = link .accessibilityValue ;
@@ -1631,7 +1630,7 @@ - (id)initWithCoder:(NSCoder *)coder {
1631
1630
[self commonInit ];
1632
1631
1633
1632
if ([coder containsValueForKey: NSStringFromSelector (@selector (enabledTextCheckingTypes ))]) {
1634
- self.enabledTextCheckingTypes = [[coder decodeObjectForKey: NSStringFromSelector (@selector (enabledTextCheckingTypes ))] unsignedLongLongValue ];
1633
+ self.enabledTextCheckingTypes = [( NSNumber *) [coder decodeObjectForKey: NSStringFromSelector (@selector (enabledTextCheckingTypes ))] unsignedLongLongValue ];
1635
1634
}
1636
1635
1637
1636
if ([NSMutableParagraphStyle class ]) {
@@ -1658,11 +1657,11 @@ - (id)initWithCoder:(NSCoder *)coder {
1658
1657
}
1659
1658
1660
1659
if ([coder containsValueForKey: NSStringFromSelector (@selector (shadowRadius ))]) {
1661
- self.shadowRadius = [[coder decodeObjectForKey: NSStringFromSelector (@selector (shadowRadius ))] floatValue ];
1660
+ self.shadowRadius = [( NSNumber *) [coder decodeObjectForKey: NSStringFromSelector (@selector (shadowRadius ))] floatValue ];
1662
1661
}
1663
1662
1664
1663
if ([coder containsValueForKey: NSStringFromSelector (@selector (highlightedShadowRadius ))]) {
1665
- self.highlightedShadowRadius = [[coder decodeObjectForKey: NSStringFromSelector (@selector (highlightedShadowRadius ))] floatValue ];
1664
+ self.highlightedShadowRadius = [( NSNumber *) [coder decodeObjectForKey: NSStringFromSelector (@selector (highlightedShadowRadius ))] floatValue ];
1666
1665
}
1667
1666
1668
1667
if ([coder containsValueForKey: NSStringFromSelector (@selector (highlightedShadowOffset ))]) {
@@ -1674,27 +1673,27 @@ - (id)initWithCoder:(NSCoder *)coder {
1674
1673
}
1675
1674
1676
1675
if ([coder containsValueForKey: NSStringFromSelector (@selector (kern ))]) {
1677
- self.kern = [[coder decodeObjectForKey: NSStringFromSelector (@selector (kern ))] floatValue ];
1676
+ self.kern = [( NSNumber *) [coder decodeObjectForKey: NSStringFromSelector (@selector (kern ))] floatValue ];
1678
1677
}
1679
1678
1680
1679
if ([coder containsValueForKey: NSStringFromSelector (@selector (firstLineIndent ))]) {
1681
- self.firstLineIndent = [[coder decodeObjectForKey: NSStringFromSelector (@selector (firstLineIndent ))] floatValue ];
1680
+ self.firstLineIndent = [( NSNumber *) [coder decodeObjectForKey: NSStringFromSelector (@selector (firstLineIndent ))] floatValue ];
1682
1681
}
1683
1682
1684
1683
if ([coder containsValueForKey: NSStringFromSelector (@selector (lineSpacing ))]) {
1685
- self.lineSpacing = [[coder decodeObjectForKey: NSStringFromSelector (@selector (lineSpacing ))] floatValue ];
1684
+ self.lineSpacing = [( NSNumber *) [coder decodeObjectForKey: NSStringFromSelector (@selector (lineSpacing ))] floatValue ];
1686
1685
}
1687
1686
1688
1687
if ([coder containsValueForKey: NSStringFromSelector (@selector (minimumLineHeight ))]) {
1689
- self.minimumLineHeight = [[coder decodeObjectForKey: NSStringFromSelector (@selector (minimumLineHeight ))] floatValue ];
1688
+ self.minimumLineHeight = [( NSNumber *) [coder decodeObjectForKey: NSStringFromSelector (@selector (minimumLineHeight ))] floatValue ];
1690
1689
}
1691
1690
1692
1691
if ([coder containsValueForKey: NSStringFromSelector (@selector (maximumLineHeight ))]) {
1693
- self.maximumLineHeight = [[coder decodeObjectForKey: NSStringFromSelector (@selector (maximumLineHeight ))] floatValue ];
1692
+ self.maximumLineHeight = [( NSNumber *) [coder decodeObjectForKey: NSStringFromSelector (@selector (maximumLineHeight ))] floatValue ];
1694
1693
}
1695
1694
1696
1695
if ([coder containsValueForKey: NSStringFromSelector (@selector (lineHeightMultiple ))]) {
1697
- self.lineHeightMultiple = [[coder decodeObjectForKey: NSStringFromSelector (@selector (lineHeightMultiple ))] floatValue ];
1696
+ self.lineHeightMultiple = [( NSNumber *) [coder decodeObjectForKey: NSStringFromSelector (@selector (lineHeightMultiple ))] floatValue ];
1698
1697
}
1699
1698
1700
1699
if ([coder containsValueForKey: NSStringFromSelector (@selector (textInsets ))]) {
@@ -1803,7 +1802,7 @@ - (id)initWithCoder:(NSCoder *)aDecoder {
1803
1802
#pragma mark -
1804
1803
1805
1804
static inline CGColorRef CGColorRefFromColor (id color) {
1806
- return [color isKindOfClass: [UIColor class ]] ? [color CGColor ] : (__bridge CGColorRef )color;
1805
+ return [( NSObject *) color isKindOfClass: [UIColor class ]] ? [(UIColor *) color CGColor ] : (__bridge CGColorRef )color;
1807
1806
}
1808
1807
1809
1808
static inline CTFontRef CTFontRefFromUIFont (UIFont * font) {
@@ -1832,9 +1831,9 @@ static inline CTFontRef CTFontRefFromUIFont(UIFont * font) {
1832
1831
key = [NSToCTAttributeNamesMap objectForKey: key] ? : key;
1833
1832
1834
1833
if (![NSMutableParagraphStyle class ]) {
1835
- if ([value isKindOfClass: [UIFont class ]]) {
1834
+ if ([( NSObject *) value isKindOfClass: [UIFont class ]]) {
1836
1835
value = (__bridge id )CTFontRefFromUIFont (value);
1837
- } else if ([value isKindOfClass: [UIColor class ]]) {
1836
+ } else if ([( NSObject *) value isKindOfClass: [UIColor class ]]) {
1838
1837
value = (__bridge id )((UIColor *)value).CGColor ;
1839
1838
}
1840
1839
}
0 commit comments