Created
September 18, 2011 23:29
-
-
Save tetek/1225709 to your computer and use it in GitHub Desktop.
SuggestionMenu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //I've made sugMenu instance variable and initialized it. | |
| sugMenu = [[SuggestionMenu alloc] initWithSortedArray:array]; | |
| //make sure you are implementing UITextFieldDelegate protocol | |
| -(void)textFieldDidBeginEditing:(UITextField *)textField{ | |
| [sugMenu suggestForText:@"" inField:textField]; | |
| } | |
| //easy as that... | |
| - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{ | |
| NSString *rightText = [NSString stringWithFormat:@"%@%@",textField.text,string]; | |
| [sugMenu suggestForText:rightText inField:textField]; | |
| return YES; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment