【问题标题】:How to perform an action when Selecting one of results of UISearchController选择 UISearchController 的结果之一时如何执行操作
【发布时间】:2014-02-11 17:00:56
【问题描述】:

我有一张姓名表,顶部有一个搜索栏。 I need to perform an action when one of the result rows selected, which is hide the table view and show another view.

didSelectRowAtIndexPath 中,我正在执行以下操作:

if ([self.searchDisplayController isActive]) {                
     Selection =  [searchResult objectAtIndex:indexPath.row];
     tableView.hidden = YES;
     DetailView.hidden = NO;               
}

我也试过了

if(tableView == self.searchDisplayController.searchResultsTableView)

我没有另一个控制器来使用“Segue”,我的两个视图都在同一个控制器中。

【问题讨论】:

  • 您确定您的委托已设置吗?你的 if 语句会被调用吗?
  • @ansible,在 if 语句中,我正在打印“Selection”字符串,这是从结果中选择的行,这意味着它会响应 if 语句。

标签: ios iphone objective-c uitableview uisearchbar


【解决方案1】:

我已经通过将想要的视图放在前面来解决问题

[self.view bringSubviewToFront:BuildingView];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-12-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-09
    相关资源
    最近更新 更多