简体   繁体   中英

How do I use a non-stretchable, but repeating background image for UISlider track?

Is it possible to set a track image for the UISlider which does not strech, but repeats itself?

I have a background image with small position points (the attached image is exmaple... mine is horizontal). So if the UISlider is longer than the image itself, it starts to stretch it and the position points are not symmetrical any more. Would be really nice that if the slider or the thumb exceeds track image width, then it just repeats itself.

Something similar to css background-repeat: repeat-x;

在此输入图像描述

You can use - (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets .

It only works on iOS 5 and later though.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM