用于搜索数组项并将其显示在表格视图上的搜索栏?

发布于 2024-09-01 11:02:48 字数 348 浏览 1 评论 0原文

我想构建一个显示空表格视图的应用程序。然后,用户可以在搜索栏上编写文本,当他们单击“搜索”按钮时,表格视图将写入已创建的数组项。

我只需要在用户单击 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

给我一枪 2024-09-08 11:02:48

您是否更新与 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文