0

我有一个 UISearchBar 有一些奇怪的行为(iOS 7)。这些是我采取的步骤:

1)我进行搜索并从表中选择一个结果。

2)我用这个代码(任何一行)清除搜索文本

-(void) tableView:(UITableView *)tableView
        didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{
   [[[self searchDisplayController] searchBar] setText:nil];    
   [[[self searchDisplayController] searchBar] setText:@""];
   //other stuff
}

3)我做第二次搜索。但除非我首先点击搜索字段内的“清除按钮”,否则不会显示任何结果。点击“x”后,行为恢复正常。

用户选择其中一个搜索结果后,您应该如何清除搜索字符串?

4

0 回答 0