0

The code below works well on iOS 6 and below

NSArray *itemArray = [NSArray arrayWithObjects:
    [UIImage imageNamed:@"segment1.png"],
    [UIImage imageNamed:@"segment2.png"],
    nil];

but on iOS 7 only displays two colors block

enter image description here

Your comment welcome

arachide
  • 8,006
  • 18
  • 71
  • 134

1 Answers1

1

For ios7, the default treatment for images with a segmented control is to colorise them according to the tint properties of the segmented control. To override this behaviour, use the following code

NSArray *itemArray = [NSArray arrayWithObjects:
[[UIImage imageNamed:@"segment1.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal],
[[UIImage imageNamed:@"segment2.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal],
nil];
tjboneman
  • 668
  • 4
  • 8