Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
thermogl committed Oct 12, 2013
1 parent d620b3f commit 0281ded
Showing 1 changed file with 7 additions and 18 deletions.
25 changes: 7 additions & 18 deletions TITokenField.m
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,8 @@ - (void)tokenFieldDidEndEditing:(TITokenField *)field {
- (void)tokenFieldTextDidChange:(TITokenField *)field {
[self resultsForSearchString:_tokenField.text];

if (_forcePickSearchResult) {
[self setSearchResultsVisible:YES];
} else {
[self setSearchResultsVisible:(_resultsArray.count > 0)];
}
if (_forcePickSearchResult) [self setSearchResultsVisible:YES];
else [self setSearchResultsVisible:(_resultsArray.count > 0)];
}

- (void)tokenFieldFrameWillChange:(TITokenField *)field {
Expand Down Expand Up @@ -559,19 +556,12 @@ - (void)didEndEditing {
}

- (void)didChangeText {
if (!self.text.length) {
[self setText:kTextEmpty];
}

[self showOrHidePlaceHolderLabel];
if (!self.text.length)[self setText:kTextEmpty];
[self showOrHidePlaceHolderLabel];
}

- (void) showOrHidePlaceHolderLabel {
if (([self.text isEqualToString:kTextEmpty]) && ([_tokens count] == 0)) {
[_placeHolderLabel setHidden:NO];
} else {
[_placeHolderLabel setHidden:YES];
}
[_placeHolderLabel setHidden:!(([self.text isEqualToString:kTextEmpty]) && !_tokens.count)];
}

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
Expand Down Expand Up @@ -627,7 +617,7 @@ - (void)addToken:(TIToken *)token {
[delegate tokenField:self didAddToken:token];
}

[self showOrHidePlaceHolderLabel];
[self showOrHidePlaceHolderLabel];
}

[self setResultsModeEnabled:NO];
Expand All @@ -653,8 +643,7 @@ - (void)removeToken:(TIToken *)token {
[delegate tokenField:self didRemoveToken:token];
}

[self showOrHidePlaceHolderLabel];

[self showOrHidePlaceHolderLabel];
[self setResultsModeEnabled:_forcePickSearchResult];
}
}
Expand Down

0 comments on commit 0281ded

Please sign in to comment.