Guest User

Untitled

a guest
Jun 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. func setupSearchController() {
  2. searchController.searchBar.placeholder = "Search Routines"
  3. navigationItem.searchController = searchController
  4. searchController.searchBar.setupSearchBarAppearance()
  5. }
  6.  
  7. func setupSearchBarAppearance() {
  8. if let textfield = value(forKey: "searchField") as? UITextField {
  9. if let backgroundview = textfield.subviews.first {
  10. backgroundview.backgroundColor = UIColor(red: 49/255, green: 69/255, blue: 89/255, alpha: 1.0)
  11.  
  12. backgroundview.layer.cornerRadius = 10;
  13. backgroundview.clipsToBounds = true;
  14. }
  15. }
  16. }
  17.  
  18. func setupSearchBarAppearance() {
  19. if let textfield = value(forKey: "searchField") as? UITextField {
  20. if let backgroundview = textfield.subviews.first {
  21.  
  22. // Changing this to a default color works
  23. backgroundview.backgroundColor = UIColor.green
  24.  
  25. backgroundview.layer.cornerRadius = 10;
  26. backgroundview.clipsToBounds = true;
  27. }
  28. }
  29. }
Add Comment
Please, Sign In to add comment