I see the dimsBackgroundDuringPresentation
is now deprecated in iOS SDK 12. What is the replacement of this attribute?
The UISearchController was introduced a couple years ago in iOS 8 to replace the now deprecated UISearchDisplayController. In the new search controller, it is easier to add search to your table views. As of Xcode 8.1, the UISearchController has not been added to Interface Builder, so you have to add it programmatically.
The initializer to UISearchController can take an argument that can specify a different view controller to show the search results. I think the most common use case is to show the search results in the same view controller that has the table view. Passing nil indicates that we do not want another view controller to show the search results.
One limitation with the UISearchController is it only works with UITableViewControllers. Regular UIViewControllers that contain a UITableView are not supported. In my next blog post, I’ll show you how you can get around this limitation.
Passing nil indicates that we do not want another view controller to show the search results. Now that we created the UISearchController, we need to apply a few settings. In the viewDidLoad function configure the UISearchController with the following code: Let me explain what you just added:
In Docs Use the
obscuresBackgroundDuringPresentation
property instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With