Skip to content

Commit

Permalink
Add support for an unlimited number of custom delimiters.
Browse files Browse the repository at this point in the history
  • Loading branch information
Neeraj Baid committed May 9, 2015
1 parent 4ff6232 commit c2e39c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions VENTokenField/VENTokenField.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@

@property (strong, nonatomic) UILabel *toLabel;

@property (strong, nonatomic) NSArray *delimiters;

@property (copy, nonatomic) NSString *placeholderText;
@property (copy, nonatomic) NSString *inputTextFieldAccessibilityLabel;

Expand Down
8 changes: 8 additions & 0 deletions VENTokenField/VENTokenField.m
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,14 @@ - (void)textFieldDidBeginEditing:(UITextField *)textField
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
[self unhighlightAllTokens];
if ([self.delimiters containsObject:string]) {
if ([self.delegate respondsToSelector:@selector(tokenField:didEnterText:)]) {
if ([textField.text length]) {
[self.delegate tokenField:self didEnterText:textField.text];
return NO;
}
}
}
return YES;
}

Expand Down

0 comments on commit c2e39c9

Please sign in to comment.