After doing some tests and trying several different locations for the customization, I believe this may indeed be a bug.
Even with a very simple straight UISegmentedControl, this is what I get (using Xcode 4.3.1, iOS 5.1):
After launching and selecting the middle element in code:
After user-clicked away and clicking back on middle element:
I used 3px wide images for the separators and 1px wide images for the backgrounds.
Edit:
I think I found a workaround: try queueing the instruction to select the element, rather than executing it in viewDidLoad, like this:
dispatch_async(dispatch_get_main_queue(),^{
self.segmentedControl.selectedSegmentIndex = 1;
});
On my example above, queuing that instruction makes it work just fine.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…