如何隐藏 UISearchBar 创建的 UITableView?
在我的 iPhone 应用程序中,我有一个搜索栏和搜索显示控制器。当用户在搜索框中键入内容时,表视图会加载并可见。当用户单击一行时,我想摆脱 tableView 并返回到用户最初单击搜索栏的视图。我搜索了所有文档,但在任何地方都找不到如何执行此操作。我已经尝试过 [tableView setHidden:YES];
但当用户再次单击搜索栏时,tableView 永远不会返回。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:NO];
}
请有人指出我正确的方向。
In my iPhone application I have a search bar and search display controller. When the user types something in the search box, the table view loads and is now visible. When a user clicks on a row, I would like to get rid of the tableView and go back to the view where the user originally clicked the search bar. I have searched all over the documentation, I cannot find how to do this anywhere. I have tried [tableView setHidden:YES];
but when the user clicks on the search bar again the tableView never returns.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:NO];
}
Please can someone point me in the right direction.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以尝试像
you can try smth like
为什么不直接从视图层次结构中删除表视图呢?
Why don't you just remove the table view from the View Hierarchy?