Skip to content

Commit c3176b0

Browse files
louosoGraham Chance
authored andcommitted
exposing the focused underline color
1 parent 5c62fa4 commit c3176b0

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
@@ -60,6 +60,11 @@ IB_DESIGNABLE
6060
*/
6161
@property (nonatomic) IBInspectable UIColor *underlineColor;
6262

63+
/**
64+
* The color of the underline when the text field is in focus.
65+
*/
66+
@property (nonatomic) IBInspectable UIColor *focusedUnderlineColor;
67+
6368
/**
6469
* To display an error under the text field, provide an NSError with a localized description.
6570
*

MaterialTextField/MFTextField.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,8 @@ - (void)updateUnderlineColor
363363
underlineColor = self.errorColor;
364364
}
365365
else {
366-
underlineColor = self.isFirstResponder ? self.tintColor : self.underlineColor;
366+
UIColor * focusedUnderlineColor = self.focusedUnderlineColor ?: self.tintColor;
367+
underlineColor = self.isFirstResponder ? focusedUnderlineColor : self.underlineColor;
367368
}
368369

369370
self.underlineLayer.backgroundColor = underlineColor.CGColor;

0 commit comments

Comments
 (0)