Customizing UISlider look

前端 未结 7 567
萌比男神i
萌比男神i 2020-12-10 14:30

To customize the visual look of a UISlider you can set the thumb and track images. Part of the track images gets stretched to the appropriate with. From the documentation:

相关标签:
7条回答
  • 2020-12-10 15:31

    I know it's late answer.

    But I solved the problem as the following:

    4 is the width of the round cap in the png file.

    UIImage *minimum = [UIImage imageNamed:@"slider_minimum.png"];
    [slider setMinimumTrackImage:[minimum stretchableImageWithLeftCapWidth:4 topCapHeight:0]
                          forState:UIControlStateNormal];
    
    0 讨论(0)
提交回复
热议问题