SearchTextField
SearchTextField copied to clipboard
inlineMode not working on iOS11
let mySearchTextField = SearchTextField(frame: CGRect(x:10, y: 100, width:200, height:40)) // Set the array of strings you want to suggest mySearchTextField.backgroundColor = UIColor.red mySearchTextField.inlineMode = true mySearchTextField.filterStrings(["Red", "Blue", "Yellow"]) self.view.addSubview(mySearchTextField)
"the above code" runs really well on iOS 10 but iOS 11 one more thing, the example still work on iOS 11 but when i take the textfield out of table, then put it into a new ViewController. it doesn't work anymore. really really dont understand this bug
Hello, @KohFujimura!
fileprivate func buildPlaceholderLabel() {
var newRect = self.placeholderRect(forBounds: self.bounds)
var caretRect = self.caretRect(for: self.beginningOfDocument)
let textRect = self.textRect(forBounds: self.bounds)
On iOS 11 func placeholderRect(forBounds bounds: CGRect) -> CGRect
or newRect
returned height is equal to zero if placeholder empty. I fixed that, appending space into placeholder.
Hope it helps you :)