我将尝试隐藏搜索栏,直到用户向上滚动。它的确起作用,但是当用户滚动时,搜索栏会变成白色。我使用以下代码来隐藏它:
这是发生的事情:
在滚动之前:
在滚动之后:
这是滚动后应该看起来的样子:
self.tableView.contentOffset = CGPointMake(0.0, 44.0);
我也尝试使用以下代码:CGRect newBounds = self.tableView.bounds;
newBounds.origin.y = newBounds.origin.y + self.SearchBar.bounds.size.height;
self.tableView.bounds = newBounds;
这是发生的事情:
在滚动之前:
![Before scrolling](https://istack.dev59.com/3b1VR.webp)
![After scrolling](https://istack.dev59.com/1He1W.webp)
![Example](https://istack.dev59.com/iaVff.webp)