Skip to content

Commit 3c6251a

Browse files
committed
exposing the focused underline color
1 parent c9f587a commit 3c6251a

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
@@ -357,7 +357,8 @@ - (void)updateUnderlineColor
357357
underlineColor = self.errorColor;
358358
}
359359
else {
360-
underlineColor = self.isFirstResponder ? self.tintColor : self.underlineColor;
360+
UIColor * focusedUnderlineColor = self.focusedUnderlineColor ?: self.tintColor;
361+
underlineColor = self.isFirstResponder ? focusedUnderlineColor : self.underlineColor;
361362
}
362363

363364
self.underlineLayer.backgroundColor = underlineColor.CGColor;

0 commit comments

Comments
 (0)