diff --git a/Mastodon/Scene/Search/SearchViewController.swift b/Mastodon/Scene/Search/SearchViewController.swift index f3638e58b..89b71f499 100644 --- a/Mastodon/Scene/Search/SearchViewController.swift +++ b/Mastodon/Scene/Search/SearchViewController.swift @@ -157,12 +157,6 @@ extension SearchViewController { view.bringSubviewToFront(statusBar) } - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - - searchBar.tintColor = Asset.Colors.brandBlue.color - } - override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) @@ -182,8 +176,8 @@ extension SearchViewController { searchBar.translatesAutoresizingMaskIntoConstraints = false NSLayoutConstraint.activate([ searchBar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor), - searchBar.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor), - searchBar.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor), + searchBar.leadingAnchor.constraint(equalTo: view.leadingAnchor), + searchBar.trailingAnchor.constraint(equalTo: view.trailingAnchor), ]) statusBar.translatesAutoresizingMaskIntoConstraints = false diff --git a/Mastodon/Service/ThemeService/ThemeService.swift b/Mastodon/Service/ThemeService/ThemeService.swift index 8a1b94179..c55000b8a 100644 --- a/Mastodon/Service/ThemeService/ThemeService.swift +++ b/Mastodon/Service/ThemeService/ThemeService.swift @@ -62,9 +62,10 @@ final class ThemeService { UITableViewCell.appearance().selectionColor = theme.tableViewCellSelectionBackgroundColor // set search bar appearance - UISearchBar.appearance().barTintColor = theme.navigationBarBackgroundColor UISearchBar.appearance().tintColor = Asset.Colors.brandBlue.color - + UISearchBar.appearance().barTintColor = theme.navigationBarBackgroundColor + let cancelButtonAttributes: [NSAttributedString.Key : Any] = [NSAttributedString.Key.foregroundColor: Asset.Colors.brandBlue.color] + UIBarButtonItem.appearance(whenContainedInInstancesOf: [UISearchBar.self]).setTitleTextAttributes(cancelButtonAttributes, for: .normal) } }