Skip to content

Commit c621c8a

Browse files
committed
exposing the focused placeholder color
1 parent 3c6251a commit c621c8a

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

MaterialTextField/MFTextField.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ IB_DESIGNABLE
3838
*/
3939
@property (nonatomic) IBInspectable UIColor *placeholderColor;
4040

41+
/**
42+
* The color of the placeholder label when the text field is in focus.
43+
*/
44+
@property (nonatomic) IBInspectable UIColor *focusedPlaceholderColor;
45+
4146
/**
4247
* Defaults to the first applicable font:
4348
* - the attributed placeholder font at the default placeholder size

MaterialTextField/MFTextField.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,8 @@ - (void)updatePlaceholderColor
488488
UIColor *color;
489489

490490
if (self.isFirstResponder) {
491-
color = (self.hasError) ? self.errorColor : self.tintColor;
491+
UIColor * focusedPlaceHolderColor = self.focusedPlaceholderColor ?: self.tintColor;
492+
color = (self.hasError) ? self.errorColor : focusedPlaceHolderColor;
492493
}
493494
else {
494495
color = self.placeholderColor;

0 commit comments

Comments
 (0)