Skip to content

Commit

Permalink
Merge pull request #77 from walsh2000/fix_issue_76
Browse files Browse the repository at this point in the history
Clear input when we are adjusting frame
  • Loading branch information
ayanonagon committed Sep 11, 2015
2 parents a9d058c + 3387a21 commit 7586ae8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions VENTokenField/VENTokenField.m
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ - (void)layoutTokensAndInputWithFrameAdjustment:(BOOL)shouldAdjustFrame

[self layoutToLabelInView:self.scrollView origin:CGPointZero currentX:&currentX];
[self layoutTokensWithCurrentX:&currentX currentY:&currentY];
[self layoutInputTextFieldWithCurrentX:&currentX currentY:&currentY];
[self layoutInputTextFieldWithCurrentX:&currentX currentY:&currentY clearInput:shouldAdjustFrame];

if (shouldAdjustFrame) {
[self adjustHeightForCurrentY:currentY];
Expand Down Expand Up @@ -248,7 +248,7 @@ - (void)layoutScrollView
[self addSubview:self.scrollView];
}

- (void)layoutInputTextFieldWithCurrentX:(CGFloat *)currentX currentY:(CGFloat *)currentY
- (void)layoutInputTextFieldWithCurrentX:(CGFloat *)currentX currentY:(CGFloat *)currentY clearInput:(BOOL)clearInput
{
CGFloat inputTextFieldWidth = self.scrollView.contentSize.width - *currentX;
if (inputTextFieldWidth < self.minInputWidth) {
Expand All @@ -258,7 +258,9 @@ - (void)layoutInputTextFieldWithCurrentX:(CGFloat *)currentX currentY:(CGFloat *
}

VENBackspaceTextField *inputTextField = self.inputTextField;
inputTextField.text = @"";
if (clearInput) {
inputTextField.text = @"";
}
inputTextField.frame = CGRectMake(*currentX, *currentY + 1, inputTextFieldWidth, [self heightForToken] - 1);
inputTextField.tintColor = self.colorScheme;
[self.scrollView addSubview:inputTextField];
Expand Down

0 comments on commit 7586ae8

Please sign in to comment.