ModernSearchBar | famous iOS search bar with auto completion feature | Autocomplete library
kandi X-RAY | ModernSearchBar Summary
kandi X-RAY | ModernSearchBar Summary
The famous iOS search bar with auto completion feature implemented.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ModernSearchBar
ModernSearchBar Key Features
ModernSearchBar Examples and Code Snippets
Community Discussions
Trending Discussions on ModernSearchBar
QUESTION
Disclaimer: I'm fairly new to Swift and come from a non developer background - so do bear with me while I explain the issue. I'm using Swift 4, Xcode 9
I needed an auto suggest feature on a UISearchBar
I'm using within my app - for which I've used the ModernSearchBar library. It's been working fine for me, but recently I edited my UISearchBar
code so that it moves to the top of the page and a larger area is available for users to see suggestions within. But I'm currently facing this issue - so while the UISearchBar
goes up as expected the suggestions list does not. I know this problem is very specific to this library but I would greatly appreciate it if someone pointed me in the right direction on this.
ModernSearchBar itself is a pretty neat addition to the app otherwise and I would like to retain it if possible. But do let me know if I should consider moving away from it and build the UI out myself.
...ANSWER
Answered 2018-May-25 at 01:27So found a relatively easy solution - the file ModernSearchBar.swift
in the library has a function called configureViews()
that sets the attributes of the UITableView
(which is the the suggestions list). I edited the searchBar(_ searchBar: UISearchBar, textDidChange searchText: String)
function and added this line if self.suggestionsView.frame.height == 0.0 { self.configureViews() }
to it. This worked, ie, the suggestions list view also got updated to the UISearchBar
's top position as expected. And it also does not update the position multiple times because of the frame height constraint.
Update:
Another issue I ran into was that if I searched for a word and returned to the previous page, the search results view would move up slightly every time and started covering the UISearchBar
section and then went out of the view. The problem got solved after I removed the code to update suggestion list size in keyboardWillShow(notification: NSNotification)
function in the same file. Not sure about the reason for this but now it works fine on the phone as well as simulator.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ModernSearchBar
Download and drop all *.swift files contained in Pod folder in your project.
Don't forget to import the assets folder too.
Enjoy !
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page