From 6a80ea4e815b75c77cddf2992e1b21ea93152b5c Mon Sep 17 00:00:00 2001 From: Mike Simons Date: Mon, 5 May 2014 22:33:29 -0400 Subject: [PATCH] Adding ability to animate UILabel.textColor. --- pop-tests/POPAnimatablePropertyTests.mm | 3 ++- pop/POPAnimatableProperty.h | 5 +++++ pop/POPAnimatableProperty.mm | 15 +++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/pop-tests/POPAnimatablePropertyTests.mm b/pop-tests/POPAnimatablePropertyTests.mm index 366dcb6d..12a8f370 100644 --- a/pop-tests/POPAnimatablePropertyTests.mm +++ b/pop-tests/POPAnimatablePropertyTests.mm @@ -54,7 +54,8 @@ - (void)testProvidedExistence kPOPViewBounds, kPOPViewSize, kPOPTableViewContentSize, - kPOPTableViewContentOffset + kPOPTableViewContentOffset, + kPOPLabelTextColor #endif ]; diff --git a/pop/POPAnimatableProperty.h b/pop/POPAnimatableProperty.h index 7395f5d0..c4da777f 100644 --- a/pop/POPAnimatableProperty.h +++ b/pop/POPAnimatableProperty.h @@ -167,4 +167,9 @@ extern NSString * const kPOPToolbarBarTintColor; */ extern NSString * const kPOPTabBarBarTintColor; +/** + Common UILabel property names. + */ +extern NSString * const kPOPLabelTextColor; + #endif diff --git a/pop/POPAnimatableProperty.mm b/pop/POPAnimatableProperty.mm index 789600ca..4a93ba78 100644 --- a/pop/POPAnimatableProperty.mm +++ b/pop/POPAnimatableProperty.mm @@ -91,6 +91,9 @@ // UITabBar NSString * const kPOPTabBarBarTintColor = kPOPNavigationBarBarTintColor; +//UILabel +NSString * const kPOPLabelTextColor = @"label.textColor"; + /** State structure internal to static animatable property. */ @@ -500,6 +503,18 @@ }, kPOPThresholdColor }, + + /* UILabel */ + + {kPOPLabelTextColor, + ^(UILabel *obj, CGFloat values[]) { + POPUIColorGetRGBAComponents(obj.textColor, values); + }, + ^(UILabel *obj, const CGFloat values[]) { + obj.textColor = POPUIColorRGBACreate(values); + }, + kPOPThresholdColor + }, #endif