How do I make a UISwitch under iOS 7 not take the background colour of the view behind it?

后端 未结 6 380
终归单人心
终归单人心 2021-02-02 11:27

It looks like this whenever off:

\"enter

While I\'d prefer more of a grey backgrou

6条回答
  •  无人及你
    2021-02-02 11:42

    You can also use an image as background, using the [UIColor colorWithPatternImage];

    mySwitch.onTintColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"toggle-bg-on"]];
    mySwitch.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"toggle-bg-off"]];
    

提交回复
热议问题