This is the effect that I'm going for:
This is what I have so far:
Cocoa does not allow you to set both an icon and text for each segment, so I was forced to burn the text into an image:
self.segmentedControl = [[UISegmentedControl alloc] initWithItems:@[
[UIImage imageNamed:@"segmentedControlContacts"],
[UIImage imageNamed:@"segmentedControlOtherApps"]
]];
The last thing I have to finish is making the normal (unselected) segment gray instead of its selected/tint blue color. The following did not work:
// themeColor is defined as a shade of blue in a category
[UIView appearance].tintColor = [UIColor themeColor];
[[UISegmentedControl appearance]
setBackgroundImage:[UIImage imageNamed:@"segmentedControlEdgeNormal"]
forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
[[UISegmentedControl appearance]
setBackgroundImage:[UIImage imageNamed:@"segmentedControlEdgeSelected"]
forState:UIControlStateSelected barMetrics:UIBarMetricsDefault];
[[UISegmentedControl appearance]
setTitleTextAttributes:@{
NSForegroundColorAttributeName: [UIColor grayColor]
}
forState:UIControlStateNormal
];