Skip to content
This repository has been archived by the owner on Nov 22, 2020. It is now read-only.

Commit

Permalink
Merge pull request #16 from alanihre/master
Browse files Browse the repository at this point in the history
Fixed a problem where the text color of the float label was changed t…
  • Loading branch information
ArtSabintsev committed Jan 2, 2016
2 parents 8d18eff + e748134 commit debe632
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions UIFloatLabelTextField/UIFloatLabelTextField.m
Expand Up @@ -336,28 +336,35 @@ - (void)layoutSubviews
#pragma mark - UIResponder (Override)
-(BOOL)becomeFirstResponder
{
[super becomeFirstResponder];

/*
verticalPadding must be manually set if textField was initialized
using NSAutoLayout constraints
*/

_floatLabel.textColor = _floatLabelActiveColor;
_storedText = [self text];
if ([super becomeFirstResponder]) {
/*
verticalPadding must be manually set if textField was initialized
using NSAutoLayout constraints
*/

_floatLabel.textColor = _floatLabelActiveColor;
_storedText = [self text];

return YES;
} else {
return NO;
}

return YES;
}

- (BOOL)resignFirstResponder
{
if ([_floatLabel.text length]) {
_floatLabel.textColor = _floatLabelPassiveColor;
if ([self canResignFirstResponder]) {
if ([_floatLabel.text length]) {
_floatLabel.textColor = _floatLabelPassiveColor;
}

[super resignFirstResponder];

return YES;
} else {
return NO;
}

[super resignFirstResponder];

return YES;
}

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
Expand Down

0 comments on commit debe632

Please sign in to comment.