Skip to content

Commit

Permalink
Updated to version 1.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
tobihagemann committed Nov 6, 2013
1 parent 4f2b9dc commit 2281a88
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
THLabel

Version 1.1.4, October 7th, 2013
Version 1.1.5, November 6th, 2013

Copyright (c) 2013 Tobias Hagemann, tobiha.de

Expand Down
4 changes: 4 additions & 0 deletions RELEASE NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 1.1.5

- Fixed text alignment for multi-line texts.

Version 1.1.4

- iOS 5 compatibilty restored. iOS 4 should also be compatible, but it's untested!
Expand Down
2 changes: 1 addition & 1 deletion THLabel.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'THLabel'
s.version = '1.1.4'
s.version = '1.1.5'
s.summary = 'THLabel is a subclass of UILabel, which additionally allows shadow blur, stroke text and fill gradient.'
s.homepage = 'https://github.com/MuscleRumble/THLabel'
s.screenshots = 'https://github.com/MuscleRumble/THLabel/blob/master/screenshot.png'
Expand Down
2 changes: 1 addition & 1 deletion THLabel/THLabel.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// THLabel.h
//
// Version 1.1.4
// Version 1.1.5
//
// Created by Tobias Hagemann on 11/25/12.
// Copyright (c) 2013 tobiha.de. All rights reserved.
Expand Down
22 changes: 20 additions & 2 deletions THLabel/THLabel.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// THLabel.m
//
// Version 1.1.4
// Version 1.1.5
//
// Created by Tobias Hagemann on 11/25/12.
// Copyright (c) 2013 tobiha.de. All rights reserved.
Expand Down Expand Up @@ -318,7 +318,7 @@ - (void)drawRect:(CGRect)rect {
- (CTFrameRef)setupFrameForDrawingOutTextRect:(CGRect *)textRect {
// Set up font.
CTFontRef fontRef = CTFontCreateWithName((__bridge CFStringRef)self.font.fontName, self.font.pointSize, NULL);
CTTextAlignment alignment = self.textAlignment;
CTTextAlignment alignment = NSTextAlignmentToCTTextAlignment ? NSTextAlignmentToCTTextAlignment(self.textAlignment) : [self CTTextAlignmentFromNSTextAlignment:self.textAlignment];
CTLineBreakMode lineBreakMode = self.lineBreakMode;
CTParagraphStyleSetting paragraphStyleSettings[] = {
{kCTParagraphStyleSpecifierAlignment, sizeof(CTTextAlignment), &alignment},
Expand Down Expand Up @@ -353,6 +353,24 @@ - (CTFrameRef)setupFrameForDrawingOutTextRect:(CGRect *)textRect {
return frameRef;
}

// Workaround for < iOS 6.
- (CTTextAlignment)CTTextAlignmentFromNSTextAlignment:(NSTextAlignment)nsTextAlignment {
switch (nsTextAlignment) {
case NSTextAlignmentLeft:
return kCTTextAlignmentLeft;
case NSTextAlignmentCenter:
return kCTTextAlignmentCenter;
case NSTextAlignmentRight:
return kCTTextAlignmentRight;
case NSTextAlignmentJustified:
return kCTTextAlignmentJustified;
case NSTextAlignmentNatural:
return kCTTextAlignmentNatural;
default:
return 0;
}
}

- (CGRect)contentRectFromBounds:(CGRect)bounds withInsets:(UIEdgeInsets)insets {
CGRect contentRect = CGRectMake(0.0, 0.0, bounds.size.width, bounds.size.height);

Expand Down

0 comments on commit 2281a88

Please sign in to comment.