I need to display an image in a segmented controller on iOs 7. The problem is that the image doesn't scale to fill the segment (it just sits in the middle).
Here is the code:
self.segmentedController.tintColor = [UIColor clearColor];
UIImage *imageSegmentedLOff;
UIImage *imageSegmentedMOn;
if ([UIImage instancesRespondToSelector:@selector(imageWithRenderingMode:)]) {
imageSegmentedLOff = [[UIImage imageNamed:IMAGE_SEGMENTED_L_OFF] resizableImageWithCapInsets:UIEdgeInsetsMake(2.0, 2.0, 2.0, 2.0)];
imageSegmentedLOff = [imageSegmentedLOff imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
imageSegmentedMOn = [[UIImage imageNamed:IMAGE_SEGMENTED_M_ON] resizableImageWithCapInsets:UIEdgeInsetsMake(2.0, 2.0, 2.0, 2.0)];
imageSegmentedMOn = [imageSegmentedMOn imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
} else {
imageSegmentedLOff = [UIImage imageNamed:IMAGE_SEGMENTED_L_OFF];
imageSegmentedMOn = [UIImage imageNamed:IMAGE_SEGMENTED_M_ON];
}
[self.segmentedController setImage:imageSegmentedLOff forSegmentAtIndex:0];
[self.segmentedController setImage:imageSegmentedMOn forSegmentAtIndex:1];
Any ideas?