ios - Customize every single UISearchBar From AppDelegate Not Working -
i have code below in appdelegate.swift
:
func customizebars() { let bartintcolor = uicolor(colorliteralred: 20/255, green: 160/255, blue: 160/255, alpha: 1) uisearchbar.appearance().tintcolor = bartintcolor window!.tintcolor = uicolor(red: 10/255, green: 80/255, blue: 80/255, alpha: 1) }
i call function (customizebars()
) in didfinishlaunchingwithoptions
method:
func application(_ application: uiapplication, didfinishlaunchingwithoptions launchoptions: [uiapplicationlaunchoptionskey: any]?) -> bool { customizebars() return true }
i have in uisearchbardelegate if makes difference:
func position(for bar: uibarpositioning) -> uibarposition { return uibarposition.topattached }
but reason when run app doesn't change tintcolor
of of uisearchbars
have in app or window
tint color. there doing wrong?
you can change search bar color using below line of code -
uisearchbar.appearance().bartintcolor = uicolor.red // change color here
but saw that, tint color(for cancel button, search icon , text color) not working in ios 10, swift 3. used work before in older versions. let me try if can find change tint color of search bar.
Comments
Post a Comment