This code used to work, but after ios 10 it has stopped functioning:
UITextField *searchTextField = [_searchBar valueForKey:@"_searchField"];
searchTextField.textAlignment = NSTextAlignmentRight
I have tried both paragraph and attributedPlaceholder, but the placeholder is always left aligned. The bug appears in xcode 7 and 8. How can I resolve this?
Maybe this a long time, here is the solution
Swift
searchBar.semanticContentAttribute = .forceRightToLeft
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