Skip to content

Commit a004345

Browse files
author
teejay
committed
Fixing issues with iOS 8.
1 parent 2c1a2cf commit a004345

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

MFLHintLabel/MFLHintLabel/MFLHintLabel/MFLHintLabel.m

+11-6
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ - (void)prepareToRun
144144
} else {
145145
[self createStringLabels];
146146
}
147-
147+
148148

149149
}
150150

@@ -244,7 +244,7 @@ - (void)constructAttributedLabels
244244
}
245245

246246
for (int i = 0; i < line.length; i++) {
247-
247+
248248
NSAttributedString*character = [line attributedSubstringFromRange:NSMakeRange(i, 1)];
249249
CGSize characterSize = character.size;
250250

@@ -435,7 +435,12 @@ - (CGFloat)implodeOntoScreen
435435
NSString *lineText = [self.lineArray objectAtIndex:i];
436436

437437
if (self.alignment == NSTextAlignmentCenter) {
438-
CGSize lineSize = [lineText sizeWithFont:self.font];
438+
CGSize lineSize;
439+
if ([lineText isKindOfClass:[NSAttributedString class]]) {
440+
lineSize = [(NSAttributedString *)lineText size];
441+
} else {
442+
lineSize = [lineText sizeWithFont:self.font];
443+
}
439444
xOffset = self.displayPosition.x + ((self.widthConstraint - lineSize.width)/2) ;
440445
}else{
441446
xOffset = self.displayPosition.x;
@@ -785,7 +790,7 @@ - (CGFloat)solitareToExitRandomly
785790
[trail setTextColor:character.textColor];
786791
[trail setFont:character.font];
787792
}
788-
793+
789794
[trail setBackgroundColor:[UIColor clearColor]];
790795
[trailArray addObject:trail];
791796

@@ -1005,7 +1010,7 @@ - (CGFloat)animateToFinalPosition
10051010
{
10061011
waitTime = 0;
10071012
}
1008-
1013+
10091014
default:
10101015
break;
10111016
}
@@ -1021,7 +1026,7 @@ - (void)stop
10211026
}
10221027

10231028
- (void)cleanAndRemoveAnimation
1024-
{
1029+
{
10251030
self.targetView = nil;
10261031

10271032
for (NSMutableArray*array in self.labelArray) {

MFLHintLabel/MFLHintLabel/MFLHintLabel/UILabel+Lines.m

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ - (NSArray*) linesForWidth:(CGFloat)width
2222
NSMutableAttributedString *attStr;
2323
if (self.attributedText) {
2424
attStr = [self.attributedText mutableCopy];
25+
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
26+
paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
27+
[attStr addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [attStr length])];
2528
} else {
2629
attStr = [[NSMutableAttributedString alloc] initWithString:self.text];
2730
CTFontRef myFont = CTFontCreateWithName((__bridge CFStringRef)([font fontName]), [font pointSize], NULL);

MFLHintLabel/MFLHintLabel/MFLViewController.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ - (IBAction)fireLinear:(id)sender
7777
{
7878
[self.hintAnimation stop];
7979
self.hintAnimation = [[MFLHintLabel alloc] createHintAnimationForText:@"The quick brown fox jumps over the lazy dog"
80-
withFont:[UIFont mapCraftHeaderWithSize:20]
80+
withFont:[UIFont mapCraftDetailWithSize:20]
8181
beginningAt:CGPointMake(40, -200)
8282
displayingAt:CGPointMake(20, self.view.center.y)
8383
endingAt:CGPointMake(40, self.view.frame.size.height+200)

0 commit comments

Comments
 (0)