我有一个xCode项目,其中包含一个带有“搜索栏和搜索显示控制器”的表视图,以允许用户优化显示的项目列表.一般而言,遵循 
 http://www.raywenderlich.com/16873/how-to-add-search-into-a-table-view中提供的指导.我最近下载了支持iOS 7的最新xCode(版本5.0(5A1413)),并且已经针对不同的目标测试了有问题的应用程序. 
  
 
在iOS 6目标(模拟器或真实设备)上运行此应用程序时,它按预期工作,这意味着按取消按钮将删除搜索栏并按清除按钮(小灰色x)清除已输入的所有搜索条件用户.但是当项目在iOS 7目标上运行时,clear和cancel按钮都不起作用.
searchBarCancelButtonClicked方法在这个项目中实现,我已经验证当目标运行iOS 7时它没有被调用.
- (void)searchBarCancelButtonClicked:(UISearchBar *)SearchBar
{
    NSLog(@"searchBarCancelButtonClicked called");
    self.searchBar.text = nil;
    …
    // Hide Search bar when cancelled
    [self hideSeachBar];
    [self.searchBar resignFirstResponder];
    …
    } 
 我的表视图控制器设置为UISearchdisplayDelegate和UISearchBarDelegate.并且它似乎仍在作为searchBar:textDidChange:在iOS 6或7目标上调用.
@interface ItemViewController () <UISearchdisplayDelegate,UISearchBarDelegate> … @end
我看不到与此或任何iOS 7更改材料(如https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TransitionGuide/Bars.html#//apple_ref/doc/uid/TP40013174-CH8-SW1)相关的任何其他帖子,其中提到了为支持iOS7而需要进行的任何重新编码.
有什么想法吗?谢谢
解决方法
 我有同样的问题,我尝试使用以下代码.请试试这个. 
  
  
 
        -(void)searchdisplayControllerDidBeginSearch:(UISearchdisplayController *)controller
{
    controller.active = YES;
    [self.view addSubview:controller.searchBar];
    [self.view bringSubviewToFront:controller.searchBar];
}
- (void)searchdisplayController:(UISearchdisplayController *)controller didShowSearchResultsTableView:(UITableView *)tableView  {
    tableView.frame = self.archiveListTblView.frame;
}
- (void)searchdisplayControllerDidEndSearch:(UISearchdisplayController *)controller
{
    controller.active=NO;
    [self.view addSubview:controller.searchBar];
}