更改颜色searchBar结果图标swift
发布时间:2020-12-14 05:46:40 所属栏目:百科 来源:网络整理
导读:如何在swift中通过代码更改结果图标的颜色? let sb = UISearchBar() sb.searchBarStyle = UISearchBarStyle.minimal sb.showsSearchResultsButton = true // sb.setClearButtonColorTo(color: UIColor.white) let textFieldInsideSearchBar = sb.value(forK
如何在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 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |