How do I apply UIAppearance Proxy properties to UILabel?

后端 未结 4 559
忘了有多久
忘了有多久 2020-11-27 20:34

I have been getting unreliable results while trying to apply UIAppearance proxy styles to the UILabel class proxy. For example, the following works as I would expect:

<
4条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-27 21:31

    Following code worked for me using swift 2.2 and for iOS 9.0

        let textFieldInsideSearchBar = self.searchBar?.valueForKey("searchField") as? UITextField
        textFieldInsideSearchBar?.textColor = BCGConstants.Colors.darkBluishPurpleColor()
    
        let textFieldInsideSearchBarLabel = textFieldInsideSearchBar!.valueForKey("placeholderLabel") as? UILabel
        textFieldInsideSearchBarLabel?.textColor = UIColor(red: 220/255, green: 209/255, blue: 231/255, alpha: 1.0)`enter code here`
    

提交回复
热议问题