【发布时间】:2019-01-11 23:40:09
【问题描述】:
【问题讨论】:
-
没用
-
好的,分享你尝试过的代码!
-
let sb = UISearchBar() sb.searchBarStyle = UISearchBarStyle.minimal sb.showsSearchResultsButton = true // sb.setClearButtonColorTo(color: UIColor.white) let textFieldInsideSearchBar = sb.value(forKey: "searchField" ) 作为? UITextField 让 crossIconView = textFieldInsideSearchBar?.value(forKey: "clearButton") as? UIButton crossIconView?.setImage(crossIconView?.currentImage?.withRenderingMode(.alwaysTemplate), for: .normal) crossIconView?.tintColor = .white
-
在 uiviewcontroller 我使用 addSubView(sb) 然后锚定它