diff --git a/MarqueeLabel.m b/MarqueeLabel.m index 4ce94bbf..4cbb0536 100755 --- a/MarqueeLabel.m +++ b/MarqueeLabel.m @@ -6,13 +6,18 @@ #import "MarqueeLabel.h" #import +// Notification strings NSString *const kMarqueeLabelControllerRestartNotification = @"MarqueeLabelViewControllerRestart"; NSString *const kMarqueeLabelShouldLabelizeNotification = @"MarqueeLabelShouldLabelizeNotification"; NSString *const kMarqueeLabelShouldAnimateNotification = @"MarqueeLabelShouldAnimateNotification"; NSString *const kMarqueeLabelAnimationCompletionBlock = @"MarqueeLabelAnimationCompletionBlock"; +// Animation completion block typedef void(^MLAnimationCompletionBlock)(BOOL finished); +// iOS Version check for iOS 8.0.0 +#define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame) + // Helpers @interface UIView (MarqueeLabelHelpers) - (UIViewController *)firstAvailableViewController; @@ -993,12 +998,23 @@ - (void)labelReturnedToHome:(BOOL)finished { - (void)setFrame:(CGRect)frame { [super setFrame:frame]; - [self updateSublabelAndLocationsAndBeginScroll:!self.orientationWillChange]; + + // Check if device is running iOS 8.0.0 + if(SYSTEM_VERSION_EQUAL_TO(@"8.0.0")) { + // If so, force update because layoutSubviews is not called + [self updateSublabelAndLocationsAndBeginScroll:!self.orientationWillChange]; + } } - (void)setBounds:(CGRect)bounds { [super setBounds:bounds]; - [self updateSublabelAndLocationsAndBeginScroll:!self.orientationWillChange]; + + // Check if device is running iOS 8.0.0 + if(SYSTEM_VERSION_EQUAL_TO(@"8.0.0")) { + // If so, force update because layoutSubviews is not called + [self updateSublabelAndLocationsAndBeginScroll:!self.orientationWillChange]; + } + } #pragma mark - Modified UILabel Methods/Getters/Setters @@ -1420,7 +1436,7 @@ - (CGFloat)YforCurveAt:(CGFloat)t withControlPoints:(NSArray *)controlPoints CGPoint P2 = [controlPoints[2] CGPointValue]; CGPoint P3 = [controlPoints[3] CGPointValue]; - // Per http://en.wikipedia.org/wiki/Bézier_curve#Cubic_B.C3.A9zier_curves + // Per http://en.wikipedia.org/wiki/Bezier_curve#Cubic_B.C3.A9zier_curves return powf((1 - t),3) * P0.y + 3.0f * powf(1 - t, 2) * t * P1.y + 3.0f * (1 - t) * powf(t, 2) * P2.y + @@ -1435,7 +1451,7 @@ - (CGFloat)XforCurveAt:(CGFloat)t withControlPoints:(NSArray *)controlPoints CGPoint P2 = [controlPoints[2] CGPointValue]; CGPoint P3 = [controlPoints[3] CGPointValue]; - // Per http://en.wikipedia.org/wiki/Bézier_curve#Cubic_B.C3.A9zier_curves + // Per http://en.wikipedia.org/wiki/Bezier_curve#Cubic_B.C3.A9zier_curves return powf((1 - t),3) * P0.x + 3.0f * powf(1 - t, 2) * t * P1.x + 3.0f * (1 - t) * powf(t, 2) * P2.x +