iOS: how to set custom background colour with sliders?

前端 未结 2 520
执念已碎
执念已碎 2021-01-29 00:16

First off I want to say I saw a couple of posts on this site about how to do this, although none seemed to work for me so please don\'t close this down until I get it working.

2条回答
  •  感情败类
    2021-01-29 00:53

    As UISlider implements the UIAppearence protocol you can set its background color like:

    mySlider.backgroundColor = [UIColor lightGrayColor]; // Or any other color
    

    or:

    [[mySlider appearance] setBackgroundColor:[UIColor lightGrayColor]];
    

提交回复
热议问题