Skip to content

Commit ec1a489

Browse files
committed
Merge pull request #180 from maximkhatskevich/master
64bit support and improved Gitignore file.
2 parents e732f6c + f1fb7cf commit ec1a489

5 files changed

Lines changed: 19 additions & 5 deletions

File tree

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
xcuserdata
1212
profile
1313
*.moved-aside
14-
14+
DerivedData
15+
.idea/
16+
*.hmap
17+
*.xcuserstate
18+
*.xccheckout
1519

1620
# old school
1721
.svn

OHAttributedLabel/OHAttributedLabel.xcodeproj/project.pbxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@
292292
09E159F7160F573A003025B4 /* Debug */ = {
293293
isa = XCBuildConfiguration;
294294
buildSettings = {
295+
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
295296
CLANG_ENABLE_OBJC_ARC = YES;
296297
CLANG_WARN_CONSTANT_CONVERSION = YES;
297298
CLANG_WARN_ENUM_CONVERSION = YES;
@@ -314,6 +315,7 @@
314315
09E159F8160F573A003025B4 /* Release */ = {
315316
isa = XCBuildConfiguration;
316317
buildSettings = {
318+
ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)";
317319
CLANG_ENABLE_OBJC_ARC = YES;
318320
CLANG_WARN_CONSTANT_CONVERSION = YES;
319321
CLANG_WARN_ENUM_CONVERSION = YES;

OHAttributedLabel/Source/NSAttributedString+Attributes.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727

2828
#import "NSAttributedString+Attributes.h"
2929

30+
#include <tgmath.h>
31+
3032
#if ! defined(COCOAPODS) && ! defined(OHATTRIBUTEDLABEL_DEDICATED_PROJECT)
3133
// Copying files in your project and thus compiling OHAttributedLabel under different build settings
3234
// 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
7173
{
7274
CFRange fitCFRange = CFRangeMake(0,0);
7375
sz = CTFramesetterSuggestFrameSizeWithConstraints(framesetter,CFRangeMake(0,0),NULL,maxSize,&fitCFRange);
74-
sz = CGSizeMake( floorf(sz.width+1) , floorf(sz.height+1) ); // take 1pt of margin for security
76+
sz = CGSizeMake( floor(sz.width+1) , floor(sz.height+1) ); // take 1pt of margin for security
7577
CFRelease(framesetter);
7678

7779
if (fitRange)
@@ -348,7 +350,9 @@ -(void)setCharacterSpacing:(CGFloat)chracterSpacing
348350
}
349351
-(void)setCharacterSpacing:(CGFloat)chracterSpacing range:(NSRange)range
350352
{
351-
[self addAttribute:(NSString *)kCTKernAttributeName value:[NSNumber numberWithFloat:chracterSpacing] range:range];
353+
[self addAttribute:(NSString *)kCTKernAttributeName
354+
value:@(chracterSpacing) // http://stackoverflow.com/a/17067994
355+
range:range];
352356
}
353357

354358
-(void)modifyParagraphStylesWithBlock:(void(^)(OHParagraphStyle* paragraphStyle))block

OHAttributedLabel/Source/OHAttributedLabel.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#import "CoreTextUtils.h"
3030
#import "OHTouchesGestureRecognizer.h"
3131

32+
#include <tgmath.h>
33+
3234
#ifndef OHATTRIBUTEDLABEL_WARN_ABOUT_KNOWN_ISSUES
3335
#define OHATTRIBUTEDLABEL_WARN_ABOUT_KNOWN_ISSUES 1
3436
#endif
@@ -556,7 +558,7 @@ - (void)drawTextInRect:(CGRect)aRect
556558
CGSize sz = CTFramesetterSuggestFrameSizeWithConstraints(framesetter,CFRangeMake(0,0),NULL,CGSizeMake(drawingRect.size.width,CGFLOAT_MAX),NULL);
557559
if (self.extendBottomToFit)
558560
{
559-
CGFloat delta = MAX(0.f , ceilf(sz.height - drawingRect.size.height)) + 10 /* Security margin */;
561+
CGFloat delta = MAX(0.f , ceil(sz.height - drawingRect.size.height)) + 10 /* Security margin */;
560562
drawingRect.origin.y -= delta;
561563
drawingRect.size.height += delta;
562564
}

OHAttributedLabel/Source/OHTouchesGestureRecognizer.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929

3030
#import <UIKit/UIGestureRecognizerSubclass.h>
3131

32+
#include <tgmath.h>
33+
3234
@interface OHTouchesGestureRecognizer ()
3335

3436
@property (nonatomic, assign) CGPoint startPoint;
@@ -49,7 +51,7 @@ - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
4951
CGPoint currentPoint = [touch locationInView:self.view];
5052
CGFloat distanceX = (currentPoint.x - _startPoint.x);
5153
CGFloat distanceY = (currentPoint.y - _startPoint.y);
52-
CGFloat distance = sqrtf(distanceX * distanceX + distanceY * distanceY);
54+
CGFloat distance = sqrt(distanceX * distanceX + distanceY * distanceY);
5355
if (distance > 10.0f) {
5456
self.state = UIGestureRecognizerStateCancelled;
5557
} else {

0 commit comments

Comments
 (0)