I currently have implemented a UISearchController which is currently working fine. Here are the attached screens that show how:
However, what I would like to do is implement it in a way that looks like how Apple implemented their language selection option in settings on the iPhone:
In Apple's implementation, the search bar does not hide the navigation bar when it is active. Does anyone know how to achieve this functionality in Swift instead of the conventional way which I have implemented currently? Just wondering.
There is a property called hidesNavigationBarDuringPresentation in the UISearchController class that by default is true that handle what do you want, so put it in false and you can achieve keep the navigation bar during the presentation as Apple do in the Language options:
searchbBarController.hidesNavigationBarDuringPresentation = false
I hope this help you
Related
sorry i'm still getting into swift, and i'm building an app with a search-for-keywords feature, but i couldn't figure it out how to implement a search bar above a keyboard like the picture below:
this picture is from an app called "Developer"
i'm thinking of that adding a toolbar with searchbar inside to the keyboard might be a solution, is there any other ways to make this thing works?
sorry for my bad english....
I recently try to develop an application in swift and wanted to make a navigation bar which is the same on every single view.
I tried different approaches. The best one so far was a solution from another stack overflow-question you can see here
The solution from Jacob King works for me, but because I am relatively new in Swift, I am concerned if his approach would add a second, third, fourth,... navigation bar every time I navigate between two views, which both inherit the navigation bar? And if that is true, how can I solve this problem?
Thanks for all efforts in advance.
From the looks of the code, he says you would need to declare each ViewController. In his case, when he taps the open search button the code would execute the open search function, so from the looks of it it would not create infinite amounts of navigation bars. Remember in the future after implementing your code you can always build and run your application to test things like these to make sure I’m right. It never hurts to try! - Colin
you have to create a viecontroller class with a navigation bar and then all the viecontrollere you will have to put
miaviewcontroller: viewcontroller_with_bar
I want to do something similar to the search bar in the IOS 10 Music app.
How might I do this? Here are some pictures:
Do you want to implement Search bar with scope? Please elaborate.
Sample :
[self.searchDisplayController.searchBar setScopeButtonTitles:#["Apple Music",#"Your Library"]];
Check below properties in File Inspector:
Capabilities - Show Cancel Button
Capabilities - Show Scope Bar
Like the two pictures, a self-window bar is above the keyboard. How to make it? Are there any third-party libraries doing it?
There's nothing complicated to it whatsoever. Assign the view you want to appear above the keyboard as the text field or view's inputAccessoryView (scroll down to that property; Apple's dodgy approach to HTML doesn't permit deeper links). No need for third-party anything; it's a built-in function of UIKit.
Besides that reference to the class documentation, Apple has documented this in the abstract and provides sample code.
Is it possible to use such a scope bar like in the phone app http://d.pr/i/xTGQ
without a Search field? I want to use it as a button, but the UITabBar is too large for that.
Thanks for help!
That's just an UISegmentedControl I think. You can create one of those in Interface Builder and use it as usual.