Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/117.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 未调用UISearchDisplayController委托方法_Ios_Uitableview_Uisearchbar_Uisearchdisplaycontroller_Uisearchbardelegate - Fatal编程技术网

Ios 未调用UISearchDisplayController委托方法

Ios 未调用UISearchDisplayController委托方法,ios,uitableview,uisearchbar,uisearchdisplaycontroller,uisearchbardelegate,Ios,Uitableview,Uisearchbar,Uisearchdisplaycontroller,Uisearchbardelegate,我正在尝试将UISearchBar添加到我在“nib”文件中定义的表视图中。我在IB中添加了搜索栏和搜索显示控制器,链接了搜索栏出口,并将其添加到视图控制器的“.h”文件中: @interface SearchListViewController : UIViewController <UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate, UISearchDisplayDelegate> 我发现调用了sho

我正在尝试将
UISearchBar
添加到我在“nib”文件中定义的表视图中。我在IB中添加了搜索栏和搜索显示控制器,链接了搜索栏出口,并将其添加到视图控制器的“.h”文件中:

@interface SearchListViewController : UIViewController <UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate, UISearchDisplayDelegate>
我发现调用了
shouldrelloadtableforSearchString:
方法,但从未调用
shouldrelloadtableforSearchScope:
方法,因此不会使用搜索结果重新加载我的表视图数据。。。我会错过什么


提前感谢

您必须将委托设置为self

searchController.delegate = self;
searchController.searchResultsDataSource = self;
searchController.searchResultsDelegate = self;

您必须将委托设置为self

searchController.delegate = self;
searchController.searchResultsDataSource = self;
searchController.searchResultsDelegate = self;

仅将
UISearchBarDelegate
放入.h类还不够,您需要将其设置为
yourserchbar.delegate=self
仅将
UISearchBarDelegate
放入.h类还不够,您需要将其设置为
yourserchbar.delegate=self注意:自IOS 8以来,UISearchDisplayDelegate已被弃用。相反,请使用UISearchDisplayController(如Rajneesh071所述)注意:自IOS 8以来,UISearchDisplayDelegate已被弃用。而是使用UISearchDisplayController(如Rajneesh071所述)