You can try with core graphics methods to tile, look at this code from this question,
CGSize imageViewSize = imageView.bounds.size;
UIGraphicsBeginImageContext(imageViewSize);
CGContextRef imageContext = UIGraphicsGetCurrentContext();
CGContextDrawTiledImage(imageContext, (CGRect){ CGPointZero, imageViewSize }, tileImage);
UIImage *finishedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
It creates a titled image. you can set image as the background to your UIcontrol.
EDIT:
tintColor
is base for creating default gradient of segment control. So setting brown gradient image as tint color gives you black gradient.
To set gradient colors,
- subclass
uisegmentcontrol
class and override drawRect
method.
- Use
backgroundImage
and set proper image insets.