Reputation: 139
How can I set UITextField such that when user touches it, a small table containing similar items (with name, photo and detail for each) appears under the field,so that by selecting any row, some data fills the field.
Maybe that's like drop down menu in android!
Thanks in advance!
I fixed the problem in this way:
UIViewController *cardVC = [UIViewController new];
cardVC.view = [[UITableView alloc] initWithFrame:CGRectMake(f.origin.x, f.origin.y + f.size.height + 5, f.size.width, 90 * COUNT)];
//add kardan table be view
[cardVC.tableView reloadData];
[self.view addSubview:cardVC.view];
but It does not load any data in table! Can any one help?
Upvotes: 0
Views: 290
Reputation: 139
I solved the problem by creating a hidden tableview under textfield in storyboard!
Upvotes: 1
Reputation: 76
You can try this: https://github.com/EddyBorja/MLPAutoCompleteTextField if you wanna implement autocomplete.
Upvotes: 0
Reputation: 26383
You need to build it by yourself, or maybe ion github there is what you need.
You can create a custom view that is composed by a UITextField
and a hidden UITableView
.
When the user tap on the textfield using the text field delegate protocol you can become aware that user is typing, based on what is typed you can show the result on a table view.
Upvotes: 0
Reputation: 109
Use text field delegate method "shouldChangeCharactersInRange" when it called add your searching logic which you want to use, if you got any result add table below the text field and when you haven't got any result remove that table.
Upvotes: 0