如何在滚动时将SearchBar修复为UITableView的标题?

时间:2018-05-02 17:52:23

标签: ios swift xcode uitableview uisearchbar

我在其中有一个带有SearchBar的TableView,但是当我滚动列表时,搜索栏会关闭顶部栏,我需要向上滚动到搜索栏。我在谷歌和堆栈溢出尝试了几个解决方案,但没有解决我的问题。

我试过了:

var myVar = _Fetch(context, end, init, key)
console.log(myVar); // undefined

滚动:

enter image description here

未滚动:

enter image description here

故事板:

enter image description here

1 个答案:

答案 0 :(得分:0)

如果您希望searchBar始终可见,则需要将其移至tableView中的storyboard上方。目前它在里面。

enter image description here