diff --git a/.gitignore b/.gitignore index e38470e..27e0a4a 100644 --- a/.gitignore +++ b/.gitignore @@ -11,7 +11,11 @@ xcuserdata profile *.moved-aside - +DerivedData +.idea/ +*.hmap +*.xcuserstate +*.xccheckout # old school .svn diff --git a/OHAttributedLabel/OHAttributedLabel.xcodeproj/project.pbxproj b/OHAttributedLabel/OHAttributedLabel.xcodeproj/project.pbxproj index 9a33645..463fa7a 100644 --- a/OHAttributedLabel/OHAttributedLabel.xcodeproj/project.pbxproj +++ b/OHAttributedLabel/OHAttributedLabel.xcodeproj/project.pbxproj @@ -292,6 +292,7 @@ 09E159F7160F573A003025B4 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES; @@ -314,6 +315,7 @@ 09E159F8160F573A003025B4 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES; diff --git a/OHAttributedLabel/Source/NSAttributedString+Attributes.m b/OHAttributedLabel/Source/NSAttributedString+Attributes.m index e64f962..598fc04 100644 --- a/OHAttributedLabel/Source/NSAttributedString+Attributes.m +++ b/OHAttributedLabel/Source/NSAttributedString+Attributes.m @@ -27,6 +27,8 @@ #import "NSAttributedString+Attributes.h" +#include + #if ! defined(COCOAPODS) && ! defined(OHATTRIBUTEDLABEL_DEDICATED_PROJECT) // Copying files in your project and thus compiling OHAttributedLabel under different build settings // than the one provided is not recommended and increase risks of leaks (mixing ARC vs. MRC) or unwanted behaviors @@ -71,7 +73,7 @@ -(CGSize)sizeConstrainedToSize:(CGSize)maxSize fitRange:(NSRange*)fitRange { CFRange fitCFRange = CFRangeMake(0,0); sz = CTFramesetterSuggestFrameSizeWithConstraints(framesetter,CFRangeMake(0,0),NULL,maxSize,&fitCFRange); - sz = CGSizeMake( floorf(sz.width+1) , floorf(sz.height+1) ); // take 1pt of margin for security + sz = CGSizeMake( floor(sz.width+1) , floor(sz.height+1) ); // take 1pt of margin for security CFRelease(framesetter); if (fitRange) @@ -348,7 +350,9 @@ -(void)setCharacterSpacing:(CGFloat)chracterSpacing } -(void)setCharacterSpacing:(CGFloat)chracterSpacing range:(NSRange)range { - [self addAttribute:(NSString *)kCTKernAttributeName value:[NSNumber numberWithFloat:chracterSpacing] range:range]; + [self addAttribute:(NSString *)kCTKernAttributeName + value:@(chracterSpacing) // http://stackoverflow.com/a/17067994 + range:range]; } -(void)modifyParagraphStylesWithBlock:(void(^)(OHParagraphStyle* paragraphStyle))block diff --git a/OHAttributedLabel/Source/OHAttributedLabel.m b/OHAttributedLabel/Source/OHAttributedLabel.m index 7053881..5c1f8b7 100755 --- a/OHAttributedLabel/Source/OHAttributedLabel.m +++ b/OHAttributedLabel/Source/OHAttributedLabel.m @@ -29,6 +29,8 @@ #import "CoreTextUtils.h" #import "OHTouchesGestureRecognizer.h" +#include + #ifndef OHATTRIBUTEDLABEL_WARN_ABOUT_KNOWN_ISSUES #define OHATTRIBUTEDLABEL_WARN_ABOUT_KNOWN_ISSUES 1 #endif @@ -556,7 +558,7 @@ - (void)drawTextInRect:(CGRect)aRect CGSize sz = CTFramesetterSuggestFrameSizeWithConstraints(framesetter,CFRangeMake(0,0),NULL,CGSizeMake(drawingRect.size.width,CGFLOAT_MAX),NULL); if (self.extendBottomToFit) { - CGFloat delta = MAX(0.f , ceilf(sz.height - drawingRect.size.height)) + 10 /* Security margin */; + CGFloat delta = MAX(0.f , ceil(sz.height - drawingRect.size.height)) + 10 /* Security margin */; drawingRect.origin.y -= delta; drawingRect.size.height += delta; } diff --git a/OHAttributedLabel/Source/OHTouchesGestureRecognizer.m b/OHAttributedLabel/Source/OHTouchesGestureRecognizer.m index eb832a1..c6c328a 100644 --- a/OHAttributedLabel/Source/OHTouchesGestureRecognizer.m +++ b/OHAttributedLabel/Source/OHTouchesGestureRecognizer.m @@ -29,6 +29,8 @@ #import +#include + @interface OHTouchesGestureRecognizer () @property (nonatomic, assign) CGPoint startPoint; @@ -49,7 +51,7 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { CGPoint currentPoint = [touch locationInView:self.view]; CGFloat distanceX = (currentPoint.x - _startPoint.x); CGFloat distanceY = (currentPoint.y - _startPoint.y); - CGFloat distance = sqrtf(distanceX * distanceX + distanceY * distanceY); + CGFloat distance = sqrt(distanceX * distanceX + distanceY * distanceY); if (distance > 10.0f) { self.state = UIGestureRecognizerStateCancelled; } else {