天堂向右,我依然向左

天下之大,虽离家千里,何处不可往!何事不可为!
生活之路,纵坎坷曲折,当奋斗不息,则精彩纷呈!

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

In a view controller you have a UITextField and a UITableView. Assign the view controller to be the delegate of the both controls, plus the data source of the table.

Implement the UITextField delegate methodtextField:shouldChangeCharactersInRange:replacementString: in your controller. This intercepts the changes as they are being typed in your text field. In this method, iterate through your list of possible options and store the matches in an NSMutableArray instance variable on your view controller. Then call [myTableView reloadData].

Have your table cells generated from the array of matches you previously stored.

It should be pretty straightforward and shouldn't take much code at all beyond a few delegate methods to get working.

 

UITextField + UIButton + UITableView即可实现。

posted on   老舟  阅读(343)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示