如何在swift中通过代码更改结果图标的颜色?
- let sb = UISearchBar()
- sb.searchBarStyle = UISearchBarStyle.minimal
- sb.showsSearchResultsButton = true
- // sb.setClearButtonColorTo(color: UIColor.white)
- let textFieldInsideSearchBar = sb.value(forKey: "searchField") as? UITextField
- let crossIconView = textFieldInsideSearchBar?.value(forKey: "clearButton") as? UIButton
- crossIconView?.setImage(crossIconView?.currentImage?.withRenderingMode(.alwaysTemplate),for: .normal)
- crossIconView?.tintColor = .white