天堂向右,我依然向左

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

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

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 2010-08-25 16:13  老舟  阅读(342)  评论(0编辑  收藏  举报