0

I have two question.

It's my code

 func searchBarSetup() {

    searchBar.showsScopeBar = true
    searchBar.scopeButtonTitles = ["Name","Effect","Component"]
    searchBar.selectedScopeButtonIndex = 0
    searchBar.delegate = self
    searchBar.showsCancelButton = false
    let darkRed = UIColor(red: 0.392, green: 0.012, blue: 0.020, alpha: 1.00)
    searchBar.tintColor = darkRed
    self.navigationItem.titleView = searchBar
    //UINavigationBar.appearance(whenContainedInInstancesOf: [UISearchBar.self]).leftView = nil
    //UINavigationBar.appearance(whenContainedInInstancesOf: [UISearchBar.self]) = nil
    //searchBar.text = searchmodel.searchText

}

enter image description here

I set scope Color but my scope color consistently blocked. So search scope backgorund color look like dark. how to change scope background color.

and when i set search bar on view i can hide magnifying glass. but now i set search bar on navigation. so can't hide magnifying glass using this code.

 UINavigationBar.appearance(whenContainedInInstancesOf: UISearchBar.self]).leftView = nil

I need your answer. Thanks

Anbu.Karthik
  • 82,064
  • 23
  • 174
  • 143
JIN
  • 3
  • 3

0 Answers0