ios - 使搜索栏和 uisearchDisplayController 看起来像普通的输入字段

标签 ios iphone objective-c uisearchbar uisearchdisplaycontroller

我在 UITableView 中有一个搜索栏,但是当我单击搜索栏时,UITableView 占据了 ViewController 的整个空间,而它应该始终作为 subview 执行并保持在给定的宽度内。其次,我想让搜索栏看起来像纸上的普通输入字段:只是下面的一条直线,而不是四周的边框。

如果能以某种方式回答这里提出的两个问题,那就太好了。

我已经包含了一个视觉引用,第一个是之前的 View ,另一个是 UISearchBar 处于事件状态时的 View 。

1

enter image description here

2

enter image description here

更新

我已经弄清楚如何通过替换 UISearchDisplayController 来阻止 UITableView 进入全屏状态。对于 UISearchBar .但是,现在我的搜索功能不再起作用了。

最佳答案

问题解决:为了防止TableView全屏,我改了UISearchDisplayController对于 UISearchBar并将搜索的委托(delegate)方法更改为:-(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText

关于ios - 使搜索栏和 uisearchDisplayController 看起来像普通的输入字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24748055/

相关文章:

iphone - 设备中有错误,但模拟器中没有错误

iphone - UIView viewWithTag 0问题

objective-c - 如何在 NSPoint 上定义基本的几何运算?

objective-c - 适合 UILabel 中的文本

ios - Parse & Swift - 如何减少服务器负载/请求?

ios - 在performDropWith委托(delegate)回调中访问源 TableView

ios - 如何在不影响用户的情况下处理 Firebase 项目?

ios - 从单元格行获取 UITableViewCell 属性

iphone - TableView :cellForRowAtIndexPath: not working correctly when testing on iphone

iphone - 如何使用 MapKit 在两个位置之间绘制路线并绘制要点?