Change color of UISwitch appwise

前端 未结 6 2080
孤独总比滥情好
孤独总比滥情好 2021-02-12 22:29

I am using UISwitch in iOS 3 to make a switch element in my app. It has default color set to blue, but I want to change its color to brown.

How can I choose

6条回答
  •  一个人的身影
    2021-02-12 23:01

    For a global change for all UISwitch elements in Swift 3, use the appearance proxy:

    UISwitch.appearance().onTintColor = UIColor.brown
    

    under the AppDelegate application:didFinishLaunchingWithOptions: method.

提交回复
热议问题