用于搜索数组项并将其显示在表格视图上的搜索栏?
我想构建一个显示空表格视图的应用程序。然后,用户可以在搜索栏上编写文本,当他们单击“搜索”按钮时,表格视图将写入已创建的数组项。
我只需要在用户单击 SearchButton 时进行搜索。我该怎么做?我必须使用什么方法?
我已经尝试过这个方法,但它不起作用。
- (void) searchBarSearchButtonClicked:(UISearchBar *)theSearchBar {
NSInteger nVideos = [appDelegate.allVideos count];
NSLog(@"number of videos: %i", nVideos);
I want to build an app that shows a empty tableview. Then users can write a text on a searchbar and when they click on Search button the tableview will be written with array items founded.
I only need to search when user click SearchButton. How can I do this? What methods do I have to use?
I've tried with this method, but it doesn't works.
- (void) searchBarSearchButtonClicked:(UISearchBar *)theSearchBar {
NSInteger nVideos = [appDelegate.allVideos count];
NSLog(@"number of videos: %i", nVideos);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否更新与 tableView 关联的数据源?据我所知,一旦用户单击带有某些搜索词的搜索按钮,您应该更新与 tableView 相关的数组并重新加载它。
Do you update your datasource that associates with tableView? As far as i can see, once user click search button with some search term, you should update your array that relates to tableView and reload it.