diff --git a/VENTokenField/VENTokenField.m b/VENTokenField/VENTokenField.m index e4de2b5..cc41048 100644 --- a/VENTokenField/VENTokenField.m +++ b/VENTokenField/VENTokenField.m @@ -212,7 +212,7 @@ - (void)layoutTokensAndInputWithFrameAdjustment:(BOOL)shouldAdjustFrame [self layoutToLabelInView:self.scrollView origin:CGPointZero currentX:¤tX]; [self layoutTokensWithCurrentX:¤tX currentY:¤tY]; - [self layoutInputTextFieldWithCurrentX:¤tX currentY:¤tY]; + [self layoutInputTextFieldWithCurrentX:¤tX currentY:¤tY clearInput:shouldAdjustFrame]; if (shouldAdjustFrame) { [self adjustHeightForCurrentY:currentY]; @@ -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) { @@ -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];