2010-05-14 50 views
0

我想构建一个显示空tableview的应用程序。然后用户可以在搜索栏上编写文本,当他们点击搜索按钮时,tableview将被写入创建的数组项。搜索栏搜索数组项并将它们显示在tableview上?

我已经看到这个教程:link text,但我只需要在用户单击SearchButton时进行搜索。我怎样才能做到这一点?我必须使用哪些方法?

我试过这种方法,但它不起作用。

- (void) searchBarSearchButtonClicked:(UISearchBar *)theSearchBar { 

    NSInteger nVideos = [appDelegate.allVideos count]; 

    NSLog(@"number of videos: %i", nVideos); 

回答

0

您是否更新了与tableView关联的数据源?据我所见,一旦用户用搜索词点击搜索按钮,你应该更新你的数组与tableView并重新加载它。