File tree Expand file tree Collapse file tree 3 files changed +16
-0
lines changed
Expand file tree Collapse file tree 3 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 6464
6565@property (strong , nonatomic ) UILabel *toLabel;
6666
67+ @property (copy , nonatomic ) NSString *placeholderText;
68+
6769- (void )setColorScheme : (UIColor *)color ;
6870
6971@end
Original file line number Diff line number Diff line change @@ -131,13 +131,20 @@ - (void)reloadData
131131 [self adjustHeightForCurrentY: currentY];
132132 [self .scrollView setContentSize: CGSizeMake (self .scrollView.contentSize.width, currentY + [self heightForToken ])];
133133
134+ [self updateInputTextField ];
134135 [self .inputTextField becomeFirstResponder ];
135136
136137 if ([self .delegate respondsToSelector: @selector (tokenFieldDidBeginEditing: )]) {
137138 [self .delegate tokenFieldDidBeginEditing: self ];
138139 }
139140}
140141
142+ - (void )setPlaceholderText : (NSString *)placeholderText
143+ {
144+ _placeholderText = placeholderText;
145+ self.inputTextField .placeholder = _placeholderText;
146+ }
147+
141148- (void )setColorScheme : (UIColor *)color
142149{
143150 _colorScheme = color;
@@ -289,6 +296,7 @@ - (VENBackspaceTextField *)inputTextField
289296 _inputTextField.autocorrectionType = UITextAutocorrectionTypeNo;
290297 _inputTextField.tintColor = self.colorScheme ;
291298 _inputTextField.delegate = self;
299+ _inputTextField.placeholder = self.placeholderText ;
292300 [_inputTextField addTarget: self action: @selector (inputTextFieldDidChange: ) forControlEvents: UIControlEventEditingChanged];
293301 }
294302 return _inputTextField;
@@ -339,6 +347,11 @@ - (void)setCursorVisibility
339347 }
340348}
341349
350+ - (void )updateInputTextField
351+ {
352+ self.inputTextField .placeholder = [self .tokens count ] ? nil : self.placeholderText ;
353+ }
354+
342355
343356#pragma mark - Data Source
344357
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ - (void)viewDidLoad
2222 self.names = [NSMutableArray array ];
2323 self.tokenField .delegate = self;
2424 self.tokenField .dataSource = self;
25+ self.tokenField .placeholderText = NSLocalizedString(@" Enter names here" , nil );
2526 [self .tokenField setColorScheme: [UIColor colorWithRed: 61 /255 .0f green: 149 /255 .0f blue: 206 /255 .0f alpha: 1 .0f ]];
2627}
2728
You can’t perform that action at this time.
0 commit comments