2014-10-03 49 views
1

我正在創建一個應用程序,我想要在IOS中的音樂應用程序中使用相同的searchBar顏色。我想知道如何更改searchBar的字段,我已經爲此搜索了周圍,但找不到任何有用的東西。這裏是一個圖像更改搜索欄中的字段背景

enter image description here

+0

退房這個http://stackoverflow.com/questions/13817330/how-to-change-inside-background-color-of -uisearchbar-component-on-ios – 2014-10-03 16:54:14

+0

這怎麼能用swift來完成? – 2014-10-03 16:56:34

回答

0

試試這個:

var textField = searchBar.valueForKey("searchField") as UITextField 
textField.backgroundColor = UIColor.redColor() 
+0

這是不是訪問私人API? – Allreadyhome 2015-08-13 10:16:36