Reputation: 131
I want to show the search engine when loading the controller.
I do not mean:
navigationItem.hidesSearchBarWhenScrolling = false
I want to hide the search engine while scrolling. I only want to show it once at the start, how can I do this?
Upvotes: 0
Views: 334
Reputation: 61
I do this:
navigationItem.hidesSearchBarWhenScrolling = false
performTaskAfterDealy(1, {
self.navigationItem.hidesSearchBarWhenScrolling = true
})
Work for me :)
ps:
func performTaskAfterDealy(_ timeInteval: TimeInterval, _ task:@escaping () -> ()) {
DispatchQueue.main.asyncAfter(deadline: (.now() + timeInteval)) {
task()
}
}
Upvotes: 1