diff --git a/Example/AppDelegate.m b/Example/AppDelegate.m index 0bb38ca5..b3684cec 100644 --- a/Example/AppDelegate.m +++ b/Example/AppDelegate.m @@ -25,20 +25,19 @@ #import "RootViewController.h" @implementation AppDelegate -@synthesize window = _window; -@synthesize navigationController = _navigationController; - -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { +- (BOOL)application:(__unused UIApplication *)application +didFinishLaunchingWithOptions:(__unused NSDictionary *)launchOptions +{ RootViewController *viewController = [[RootViewController alloc] init]; - _navigationController = [[UINavigationController alloc] initWithRootViewController:viewController]; + self.navigationController = [[UINavigationController alloc] initWithRootViewController:viewController]; - _window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.backgroundColor = [UIColor whiteColor]; self.window.rootViewController = self.navigationController; [self.window makeKeyAndVisible]; + return YES; } - @end diff --git a/Example/AttributedTableViewCell.m b/Example/AttributedTableViewCell.m index c9977153..3af1a422 100644 --- a/Example/AttributedTableViewCell.m +++ b/Example/AttributedTableViewCell.m @@ -114,7 +114,7 @@ - (void)setSummaryText:(NSString *)text { [mutableAttributedString replaceCharactersInRange:nameRange withString:[[[mutableAttributedString string] substringWithRange:nameRange] uppercaseString]]; regexp = ParenthesisRegularExpression(); - [regexp enumerateMatchesInString:[mutableAttributedString string] options:0 range:stringRange usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) { + [regexp enumerateMatchesInString:[mutableAttributedString string] options:0 range:stringRange usingBlock:^(NSTextCheckingResult *result, __unused NSMatchingFlags flags, __unused BOOL *stop) { UIFont *italicSystemFont = [UIFont italicSystemFontOfSize:kEspressoDescriptionTextFontSize]; CTFontRef italicFont = CTFontCreateWithName((__bridge CFStringRef)italicSystemFont.fontName, italicSystemFont.pointSize, NULL); if (italicFont) { @@ -138,7 +138,7 @@ - (void)setSummaryText:(NSString *)text { + (CGFloat)heightForCellWithText:(NSString *)text { static CGFloat padding = 10.0f; - return ceilf([text sizeWithFont:[UIFont systemFontOfSize:kEspressoDescriptionTextFontSize] constrainedToSize:CGSizeMake(300.0f, CGFLOAT_MAX) lineBreakMode:UILineBreakModeWordWrap].height) + padding; + return ceilf([text sizeWithFont:[UIFont systemFontOfSize:kEspressoDescriptionTextFontSize] constrainedToSize:CGSizeMake(300.0f, CGFLOAT_MAX) lineBreakMode:NSLineBreakByWordWrapping].height) + padding; } #pragma mark - UIView diff --git a/Example/DetailViewController.m b/Example/DetailViewController.m index a135873b..02867628 100644 --- a/Example/DetailViewController.m +++ b/Example/DetailViewController.m @@ -115,7 +115,7 @@ - (void)viewDidLoad { [mutableAttributedString replaceCharactersInRange:nameRange withString:[[[mutableAttributedString string] substringWithRange:nameRange] uppercaseString]]; regexp = ParenthesisRegularExpression(); - [regexp enumerateMatchesInString:[mutableAttributedString string] options:0 range:stringRange usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) { + [regexp enumerateMatchesInString:[mutableAttributedString string] options:0 range:stringRange usingBlock:^(NSTextCheckingResult *result, __unused NSMatchingFlags flags, __unused BOOL * stop) { UIFont *italicSystemFont = [UIFont italicSystemFontOfSize:kEspressoDescriptionTextFontSize]; CTFontRef italicFont = CTFontCreateWithName((__bridge CFStringRef)italicSystemFont.fontName, italicSystemFont.pointSize, NULL); if (italicFont) { @@ -139,7 +139,7 @@ - (void)viewDidLoad { #pragma mark - TTTAttributedLabelDelegate -- (void)attributedLabel:(TTTAttributedLabel *)label +- (void)attributedLabel:(__unused TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url { [[[UIActionSheet alloc] initWithTitle:[url absoluteString] delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) destructiveButtonTitle:nil otherButtonTitles:NSLocalizedString(@"Open Link in Safari", nil), nil] showInView:self.view]; diff --git a/Example/Espressos.xcodeproj/project.pbxproj b/Example/Espressos.xcodeproj/project.pbxproj index eeadeb16..8a835583 100644 --- a/Example/Espressos.xcodeproj/project.pbxproj +++ b/Example/Espressos.xcodeproj/project.pbxproj @@ -229,13 +229,43 @@ F877A37B13782AF10022A8AB /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; + CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; + GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; GCC_VERSION = ""; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_LABEL = YES; + GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.3; ONLY_ACTIVE_ARCH = YES; @@ -246,10 +276,40 @@ F877A37C13782AF10022A8AB /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES; + CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; + GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES; GCC_VERSION = ""; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; + GCC_WARN_ABOUT_MISSING_NEWLINE = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES; + GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES; + GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO; + GCC_WARN_SHADOW = YES; + GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_STRICT_SELECTOR_MATCH = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNKNOWN_PRAGMAS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_LABEL = YES; + GCC_WARN_UNUSED_PARAMETER = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 4.3; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; diff --git a/Example/RootViewController.m b/Example/RootViewController.m index e5ba8385..9c7631c1 100644 --- a/Example/RootViewController.m +++ b/Example/RootViewController.m @@ -51,12 +51,16 @@ - (void)viewDidLoad { #pragma mark - UITableViewDataSource -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return [self.espressos count]; +- (NSInteger)tableView:(__unused UITableView *)tableView + numberOfRowsInSection:(__unused NSInteger)section +{ + return (NSInteger)[self.espressos count]; } -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - return [AttributedTableViewCell heightForCellWithText:[self.espressos objectAtIndex:indexPath.row]]; +- (CGFloat)tableView:(__unused UITableView *)tableView +heightForRowAtIndexPath:(__unused NSIndexPath *)indexPath +{ + return [AttributedTableViewCell heightForCellWithText:[self.espressos objectAtIndex:(NSUInteger)indexPath.row]]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { @@ -68,7 +72,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; } - NSString *description = [self.espressos objectAtIndex:indexPath.row]; + NSString *description = [self.espressos objectAtIndex:(NSUInteger)indexPath.row]; cell.summaryText = description; cell.summaryLabel.delegate = self; cell.summaryLabel.userInteractionEnabled = YES; @@ -78,15 +82,19 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N #pragma mark - UITableViewDelegate -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - NSString *description = [self.espressos objectAtIndex:indexPath.row]; +- (void)tableView:(UITableView *)tableView +didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + NSString *description = [self.espressos objectAtIndex:(NSUInteger)indexPath.row]; DetailViewController *viewController = [[DetailViewController alloc] initWithEspressoDescription:description]; [self.navigationController pushViewController:viewController animated:YES]; + [tableView deselectRowAtIndexPath:indexPath animated:YES]; } #pragma mark - TTTAttributedLabelDelegate -- (void)attributedLabel:(TTTAttributedLabel *)label didSelectLinkWithURL:(NSURL *)url { +- (void)attributedLabel:(__unused TTTAttributedLabel *)label + didSelectLinkWithURL:(NSURL *)url { [[[UIActionSheet alloc] initWithTitle:[url absoluteString] delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", nil) destructiveButtonTitle:nil otherButtonTitles:NSLocalizedString(@"Open Link in Safari", nil), nil] showInView:self.view]; } diff --git a/TTTAttributedLabel/TTTAttributedLabel.m b/TTTAttributedLabel/TTTAttributedLabel.m index 926689e3..69de2034 100644 --- a/TTTAttributedLabel/TTTAttributedLabel.m +++ b/TTTAttributedLabel/TTTAttributedLabel.m @@ -209,7 +209,7 @@ static inline UILineBreakMode UILineBreakModeFromTTTLineBreakMode(TTTLineBreakMo static inline NSAttributedString * NSAttributedStringByScalingFontSize(NSAttributedString *attributedString, CGFloat scale) { NSMutableAttributedString *mutableAttributedString = [attributedString mutableCopy]; - [mutableAttributedString enumerateAttribute:(NSString *)kCTFontAttributeName inRange:NSMakeRange(0, [mutableAttributedString length]) options:0 usingBlock:^(id value, NSRange range, BOOL *stop) { + [mutableAttributedString enumerateAttribute:(NSString *)kCTFontAttributeName inRange:NSMakeRange(0, [mutableAttributedString length]) options:0 usingBlock:^(id value, NSRange range, BOOL * __unused stop) { UIFont *font = (UIFont *)value; if (font) { NSString *fontName; @@ -239,7 +239,7 @@ static inline UILineBreakMode UILineBreakModeFromTTTLineBreakMode(TTTLineBreakMo } NSMutableAttributedString *mutableAttributedString = [attributedString mutableCopy]; - [mutableAttributedString enumerateAttribute:(NSString *)kCTForegroundColorFromContextAttributeName inRange:NSMakeRange(0, [mutableAttributedString length]) options:0 usingBlock:^(id value, NSRange range, BOOL *stop) { + [mutableAttributedString enumerateAttribute:(NSString *)kCTForegroundColorFromContextAttributeName inRange:NSMakeRange(0, [mutableAttributedString length]) options:0 usingBlock:^(id value, NSRange range, __unused BOOL *stop) { BOOL usesColorFromContext = (BOOL)value; if (usesColorFromContext) { [mutableAttributedString setAttributes:[NSDictionary dictionaryWithObject:color forKey:(NSString *)kCTForegroundColorAttributeName] range:range]; @@ -519,7 +519,7 @@ - (CFIndex)characterIndexAtPoint:(CGPoint)p { CGMutablePathRef path = CGPathCreateMutable(); CGPathAddRect(path, NULL, textRect); - CTFrameRef frame = CTFramesetterCreateFrame([self framesetter], CFRangeMake(0, [self.attributedText length]), path, NULL); + CTFrameRef frame = CTFramesetterCreateFrame([self framesetter], CFRangeMake(0, (CFIndex)[self.attributedText length]), path, NULL); if (frame == NULL) { CFRelease(path); return NSNotFound; @@ -533,7 +533,7 @@ - (CFIndex)characterIndexAtPoint:(CGPoint)p { return NSNotFound; } - NSUInteger idx = NSNotFound; + CFIndex idx = NSNotFound; CGPoint lineOrigins[numberOfLines]; CTFrameGetLineOrigins(frame, CFRangeMake(0, numberOfLines), lineOrigins); @@ -544,9 +544,9 @@ - (CFIndex)characterIndexAtPoint:(CGPoint)p { // Get bounding information of line CGFloat ascent = 0.0f, descent = 0.0f, leading = 0.0f; - CGFloat width = CTLineGetTypographicBounds(line, &ascent, &descent, &leading); - CGFloat yMin = floor(lineOrigin.y - descent); - CGFloat yMax = ceil(lineOrigin.y + ascent); + CGFloat width = (CGFloat)CTLineGetTypographicBounds(line, &ascent, &descent, &leading); + CGFloat yMin = (CGFloat)floor(lineOrigin.y - descent); + CGFloat yMax = (CGFloat)ceil(lineOrigin.y + ascent); // Check if we've already passed the line if (p.y > yMax) { @@ -601,7 +601,7 @@ - (void)drawFramesetter:(CTFramesetterRef)framesetter if (!(lastLineRange.length == 0 && lastLineRange.location == 0) && lastLineRange.location + lastLineRange.length < textRange.location + textRange.length) { // Get correct truncationType and attribute position CTLineTruncationType truncationType; - NSUInteger truncationAttributePosition = lastLineRange.location; + CFIndex truncationAttributePosition = lastLineRange.location; TTTLineBreakMode lineBreakMode = self.lineBreakMode; // Multiple lines, only use UILineBreakModeTailTruncation @@ -631,7 +631,7 @@ - (void)drawFramesetter:(CTFramesetterRef)framesetter NSDictionary *truncationTokenStringAttributes = self.truncationTokenStringAttributes; if (!truncationTokenStringAttributes) { - truncationTokenStringAttributes = [attributedString attributesAtIndex:truncationAttributePosition effectiveRange:NULL]; + truncationTokenStringAttributes = [attributedString attributesAtIndex:(NSUInteger)truncationAttributePosition effectiveRange:NULL]; } NSAttributedString *attributedTokenString = [[NSAttributedString alloc] initWithString:truncationTokenString attributes:truncationTokenStringAttributes]; @@ -640,12 +640,12 @@ - (void)drawFramesetter:(CTFramesetterRef)framesetter // Append truncationToken to the string // because if string isn't too long, CT wont add the truncationToken on it's own // There is no change of a double truncationToken because CT only add the token if it removes characters (and the one we add will go first) - NSMutableAttributedString *truncationString = [[attributedString attributedSubstringFromRange:NSMakeRange(lastLineRange.location, lastLineRange.length)] mutableCopy]; + NSMutableAttributedString *truncationString = [[attributedString attributedSubstringFromRange:NSMakeRange((NSUInteger)lastLineRange.location, (NSUInteger)lastLineRange.length)] mutableCopy]; if (lastLineRange.length > 0) { // Remove any newline at the end (we don't want newline space between the text and the truncation token). There can only be one, because the second would be on the next line. - unichar lastCharacter = [[truncationString string] characterAtIndex:lastLineRange.length - 1]; + unichar lastCharacter = [[truncationString string] characterAtIndex:(NSUInteger)(lastLineRange.length - 1)]; if ([[NSCharacterSet newlineCharacterSet] characterIsMember:lastCharacter]) { - [truncationString deleteCharactersInRange:NSMakeRange(lastLineRange.length - 1, 1)]; + [truncationString deleteCharactersInRange:NSMakeRange((NSUInteger)(lastLineRange.length - 1), 1)]; } } [truncationString appendAttributedString:attributedTokenString]; @@ -672,7 +672,7 @@ - (void)drawFramesetter:(CTFramesetterRef)framesetter break; } - CGFloat penOffset = CTLineGetPenOffsetForFlush(truncatedLine, flushFactor, rect.size.width); + CGFloat penOffset = (CGFloat)CTLineGetPenOffsetForFlush(truncatedLine, flushFactor, rect.size.width); CGContextSetTextPosition(c, penOffset, lineOrigin.y); CTLineDraw(truncatedLine, c); @@ -711,7 +711,7 @@ - (void)drawBackground:(CTFrameRef)frame CFIndex lineIndex = 0; for (id line in lines) { CGFloat ascent = 0.0f, descent = 0.0f, leading = 0.0f; - CGFloat width = CTLineGetTypographicBounds((__bridge CTLineRef)line, &ascent, &descent, &leading) ; + CGFloat width = (CGFloat)CTLineGetTypographicBounds((__bridge CTLineRef)line, &ascent, &descent, &leading) ; CGRect lineBounds = CGRectMake(0.0f, 0.0f, width, ascent + descent + leading) ; lineBounds.origin.x = origins[lineIndex].x; lineBounds.origin.y = origins[lineIndex].y; @@ -729,7 +729,7 @@ - (void)drawBackground:(CTFrameRef)frame CGFloat runAscent = 0.0f; CGFloat runDescent = 0.0f; - runBounds.size.width = CTRunGetTypographicBounds((__bridge CTRunRef)glyphRun, CFRangeMake(0, 0), &runAscent, &runDescent, NULL) + fillPadding.left + fillPadding.right; + runBounds.size.width = (CGFloat)CTRunGetTypographicBounds((__bridge CTRunRef)glyphRun, CFRangeMake(0, 0), &runAscent, &runDescent, NULL) + fillPadding.left + fillPadding.right; runBounds.size.height = runAscent + runDescent + fillPadding.top + fillPadding.bottom; CGFloat xOffset = CTLineGetOffsetForStringIndex((__bridge CTLineRef)line, CTRunGetStringRange((__bridge CTRunRef)glyphRun).location, NULL); @@ -765,7 +765,7 @@ - (void)drawBackground:(CTFrameRef)frame } - (void)drawStrike:(CTFrameRef)frame - inRect:(CGRect)rect + inRect:(__unused CGRect)rect context:(CGContextRef)c { NSArray *lines = (__bridge NSArray *)CTFrameGetLines(frame); @@ -775,7 +775,7 @@ - (void)drawStrike:(CTFrameRef)frame CFIndex lineIndex = 0; for (id line in lines) { CGFloat ascent = 0.0f, descent = 0.0f, leading = 0.0f; - CGFloat width = CTLineGetTypographicBounds((__bridge CTLineRef)line, &ascent, &descent, &leading) ; + CGFloat width = (CGFloat)CTLineGetTypographicBounds((__bridge CTLineRef)line, &ascent, &descent, &leading) ; CGRect lineBounds = CGRectMake(0.0f, 0.0f, width, ascent + descent + leading) ; lineBounds.origin.x = origins[lineIndex].x; lineBounds.origin.y = origins[lineIndex].y; @@ -790,7 +790,7 @@ - (void)drawStrike:(CTFrameRef)frame CGFloat runAscent = 0.0f; CGFloat runDescent = 0.0f; - runBounds.size.width = CTRunGetTypographicBounds((__bridge CTRunRef)glyphRun, CFRangeMake(0, 0), &runAscent, &runDescent, NULL); + runBounds.size.width = (CGFloat)CTRunGetTypographicBounds((__bridge CTRunRef)glyphRun, CFRangeMake(0, 0), &runAscent, &runDescent, NULL); runBounds.size.height = runAscent + runDescent; CGFloat xOffset = CTLineGetOffsetForStringIndex((__bridge CTLineRef)line, CTRunGetStringRange((__bridge CTRunRef)glyphRun).location, NULL); @@ -845,11 +845,13 @@ - (void)drawStrike:(CTFrameRef)frame #pragma mark - TTTAttributedLabel - (void)setText:(id)text { + NSParameterAssert([text isKindOfClass:[NSAttributedString class]] || [text isKindOfClass:[NSString class]]); + if ([text isKindOfClass:[NSString class]]) { [self setText:text afterInheritingLabelAttributesAndConfiguringWithBlock:nil]; return; } - + self.attributedText = text; self.activeLink = nil; @@ -862,10 +864,10 @@ - (void)setText:(id)text { #endif dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ __strong __typeof(weakSelf)strongSelf = weakSelf; - NSArray *results = [strongSelf.dataDetector matchesInString:[text string] options:0 range:NSMakeRange(0, [text length])]; + NSArray *results = [strongSelf.dataDetector matchesInString:[(NSAttributedString *)text string] options:0 range:NSMakeRange(0, [(NSAttributedString *)text length])]; if ([results count] > 0) { dispatch_sync(dispatch_get_main_queue(), ^{ - if ([[strongSelf.attributedText string] isEqualToString:[text string]]) { + if ([[strongSelf.attributedText string] isEqualToString:[(NSAttributedString *)text string]]) { [strongSelf addLinksWithTextCheckingResults:results attributes:strongSelf.linkAttributes]; } }); @@ -956,7 +958,7 @@ - (CGRect)textRectForBounds:(CGRect)bounds textRect.size.height = fmaxf(self.font.pointSize * 2.0f, bounds.size.height); // Adjust the text to be in the center vertically, if the text size is smaller than bounds - CGSize textSize = CTFramesetterSuggestFrameSizeWithConstraints([self framesetter], CFRangeMake(0, [self.attributedText length]), NULL, textRect.size, NULL); + CGSize textSize = CTFramesetterSuggestFrameSizeWithConstraints([self framesetter], CFRangeMake(0, (CFIndex)[self.attributedText length]), NULL, textRect.size, NULL); textSize = CGSizeMake(ceilf(textSize.width), ceilf(textSize.height)); // Fix for iOS 4, CTFramesetterSuggestFrameSizeWithConstraints sometimes returns fractional sizes if (textSize.height < textRect.size.height) { @@ -1012,7 +1014,7 @@ - (void)drawTextInRect:(CGRect)rect { CGContextTranslateCTM(c, 0.0f, rect.size.height); CGContextScaleCTM(c, 1.0f, -1.0f); - CFRange textRange = CFRangeMake(0, [self.attributedText length]); + CFRange textRange = CFRangeMake(0, (CFIndex)[self.attributedText length]); // First, get the text rect (which takes vertical centering into account) CGRect textRect = [self textRectForBounds:rect limitedToNumberOfLines:self.numberOfLines]; @@ -1058,7 +1060,7 @@ - (CGSize)sizeThatFits:(CGSize)size { return [super sizeThatFits:size]; } - CFRange rangeToSize = CFRangeMake(0, [self.attributedText length]); + CFRange rangeToSize = CFRangeMake(0, (CFIndex)[self.attributedText length]); CGSize constraints = CGSizeMake(size.width, TTTFLOAT_MAX); if (self.numberOfLines == 1) { @@ -1100,7 +1102,7 @@ - (BOOL)canBecomeFirstResponder { } - (BOOL)canPerformAction:(SEL)action - withSender:(id)sender + withSender:(__unused id)sender { return (action == @selector(copy:)); } @@ -1196,7 +1198,7 @@ - (void)touchesCancelled:(NSSet *)touches #pragma mark - UIResponderStandardEditActions -- (void)copy:(id)sender { +- (void)copy:(__unused id)sender { [[UIPasteboard generalPasteboard] setString:self.text]; }