If you have all the countries in a NSDictionary, you could just display them all in an UITableView. Then bind your class to the outlet of an UITextField and make the class use the UITextFieldDelegate protocol, this way you could use the function textFieldDidBeginEditing: to get the string the user is typing. Then it's just a matter of searching through the NSDictionary with countries and at the end update the UITableView. This will not generate autocomplete functionality, but the only way I know how to do that without seriously subclassing views is to use a UISearchBar.
And of course the class should also use the UITableViewDelegate protocol so that you can get notification when the user has clicked on a cell, in this case a country.
Last edited by Bovn; 07-01-2009 at 09:33 PM.
|