Skip to content

Commit f2b1df7

Browse files
louosoGraham Chance
authored andcommitted
exposing the focused placeholder color
1 parent c3176b0 commit f2b1df7

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
@@ -502,7 +502,8 @@ - (void)updatePlaceholderColor
502502
UIColor *color;
503503

504504
if (self.isFirstResponder) {
505-
color = (self.hasError) ? self.errorColor : self.tintColor;
505+
UIColor * focusedPlaceHolderColor = self.focusedPlaceholderColor ?: self.tintColor;
506+
color = (self.hasError) ? self.errorColor : focusedPlaceHolderColor;
506507
}
507508
else {
508509
color = self.placeholderColor;

0 commit comments

Comments
 (0)