objective-c - UITableView 粘在 UISearchBar 上

标签 objective-c ios uitableview uisearchbar

我有一个带有UISearchBar的 View ,一个MCSegmentedControl和一个UITableView

这是我在 UISearchBar 未激活时的 View :

enter image description here

这是我在 UISearchBar 处于事件状态时的 View

enter image description here

如您所见,当 UITableView 处于事件状态时,UITableView 会粘在 UISearchBar 上,这不是我想要的。我希望 UITableVIew 保留在 MCSegmentedControl 下方

我真的不知道要在这里放什么代码,所以如果您需要一些,请随时询问。

有谁知道如何解决这个问题吗?

谢谢

最佳答案

您实际上正在查看两个不同的 UITableView:您的 UITableView 和 UISearchDisplayController 的 searchResultsTableView(当 searchBar 处于事件状态时可见)。我自己没有尝试过,但我认为你应该能够在 searchResultsTableView 上 setFrame: 来抵消它。

关于objective-c - UITableView 粘在 UISearchBar 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10438792/

相关文章:

ios - 如何根据用户操作更改 iOS 7 中 UIView (UITextView) 的大小

ios - 在 SwiftUI 中带有导航栏标题的 EXC_BAD_ACCESS

iOS segues 数据不被传递

swift - SourceView 和 SourceRect 被贬值了吗?

ios - UITableView 单元格上的图像

objective-c - 终止应用程序原因 : 'An instance of AVPlayer cannot remove a time observer that was added by a different instance of AVPlayer.'

iphone - 第二次解析调用导致 NSXMLParser 内存泄漏

ios - UIScrollView 内部的 UIScrollView?

objective-c - UIImageView.image 大于 UIImageView

objective-c - UITableView 删除所有可重用单元格