I don't know how to modify the original searchIcon
's color.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
- “Zero out” sensitive String data in Swift
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Unable to process app at this time due to a genera
- Swift - hide pickerView after value selected
- How can I add media attachments to my push notific
As per Federica's anwser....To do this in swift
Best solution I found was here Changing the color of the icons in a UItextField inside a UISearchBar
(This solution uses the original UISearchBar's icon, no need to supply your own graphical asset)
Converted to Swift (Swift 3):
This soultion worked for me on Xcode 8.2.1 in Swift 3.0. :
Usage example:
Make sure that when you use the
setImage
API, pass an image with rendering mode ofUIImageRenderingModeAlwaysTemplate
. For example:For just changing the color of the search icon, without altering the actual icon in Swift 3:
Creates a result like so: