When a UISearchBar
is tapped, the cancel button slides in and the TextField lies over to accommodate the button. I will call this the cancel-button-animation.
In my app, when the user taps the search button, a view with a UISearchController
and a UITableView
fades in. I want the view to fade in with the cancel-button-animation already finished. Similar to the iOS music app. I have tried this:
self.myTableView.frame = CGRectMake(0, 20, self.view.bounds.width, self.view.bounds.height - 20)
self.resultSearchController.searchBar.becomeFirstResponder()
UIView.animateWithDuration(0.3, delay: 0.0, options: .CurveLinear, animations: {
self.myTableView.alpha = CGFloat(1.0)
}, completion: nil)
When I make the searchBar first responder off screen, shouldn't that complete the cancel-button-animation finish? It doesn't.
Right now, the cancel-button-animation happens while on screen, THEN the view (TableView
) fades in. How can I make the cancel-button-animation happen while the view's alpha is at 0?