iOS 11 UISearchBar background color

后端 未结 5 668
南旧
南旧 2021-02-13 19:25

I understand that this question has been asked many, many times on SO. However, as Apple does best, with the release of iOS 11, they seem to ha

5条回答
  •  遇见更好的自我
    2021-02-13 20:25

    This code changes the background color of the text field.

    Swift 4

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
            
            //background color of text field
             UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).backgroundColor = .cyan
            
            }
    

    This is the result

提交回复
热议问题