Customized UISegmentedControl draws incorrect divider when segments are disabled

Originator:elliot
Number:rdar://11031502 Date Originated:12-Mar-2012 07:34 PM
Status:Closed Resolved:June 2012
Product:iPhone SDK Product Version:>= iOS 5
Classification:UI/Usability Reproducible:YES
 
Summary:
When creating a customized UISegmentedControl using the UIAppearance APIs, the incorrect divider image will be drawn when one of the segments is in the disabled state.

Steps to Reproduce:
1. Create a UISegmentedControl with 2 segments
2. Call [mySegmentedControl setDividerImage:myDisabledSelectedDividerImage forLeftSegmentState:UIControlStateDisabled rightSegmentState:UIControlStateSelected barMetrics:UIBarMetricsDefault]
3. Set segment 0 to be disabled ([mySegmentedControl setEnabled:NO forSegmentAtIndex:0])
3. Observe that the divider image drawn is for the UIControlStateNormal-UIControlStateNormal configuration, not the UIControlStateDisabled-UIControlStateSelected configuration.

Expected Results:

UIControlStateDisabled-UIControlStateSelected divider image is drawn

Actual Results:

UIControlStateNormal-UIControlStateNormal divider image is drawn

Regression:

Only occurs using the UIAppearance API available from iOS 5 onwards.

Notes:

If a background image is used for the UIControlStateDisabled state ([UISegmentedControl setBackgroundImage:forState:barMetrics]), the control will draw this image. It seems to only be the divider image that is a problem. More details on the problem can be found at this stack overflow thread: http://stackoverflow.com/questions/9660330/uisegmentedcontrol-does-not-respect-divider-images-set-for-uicontrolstatedisable

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!