UISegmentedControl shows incorrect highlight state on backgroundImage.
| Originator: | padraig.kennedy | ||
| Number: | rdar://15259032 | Date Originated: | 17-Oct-2013 |
| Status: | Closed | Resolved: | 03-Jun-2014 |
| Product: | iOS SDK | Product Version: | 7.0.1 |
| Classification: | UI/Usability | Reproducible: | Always |
Summary:
When using setBackgroundImage:forState:barMetrics on UISegmentedControl the highlight state image shows on touchDown regardless of the rest of the state mask that's been set.
In the attached project a UISegmentedControl subclass is set up with the following images / states:
[self setBackgroundImage:[UIImage imageNamed:@"UISegmentedControlBackgroundUnselected"]
forState:UIControlStateNormal
barMetrics:UIBarMetricsDefault];
[self setBackgroundImage:[UIImage imageNamed:@"UISegmentedControlBackgroundSelected"]
forState:UIControlStateSelected
barMetrics:UIBarMetricsDefault];
[self setBackgroundImage:[UIImage imageNamed:@"UISegmentedControlBackgroundSelected"]
forState:UIControlStateHighlighted|UIControlStateSelected
barMetrics:UIBarMetricsDefault];
[self setBackgroundImage:[UIImage imageNamed:@"UISegmentedControlBackgroundHighlighted"]
forState:UIControlStateHighlighted|UIControlStateNormal
barMetrics:UIBarMetricsDefault];
When tapping on a selected UISegment, the highlighted state is displayed, even though a different image is set for the UIControlStateHighlighted|UIControlStateSelected state.
The attached project demonstrates this.
Steps to Reproduce:
1. Create an example 1 view project.
2. Add a UISegmentedControl and set it's class to a UISegmentedControl subclass
3. In awakeFromNib, set backgroundImages fro the normal, selected, highlighted and highlighted+selected states.
4. Run the app. Tap the control to select a side.
5. Tap and hold on the same segment.
7. It will show the Normal+Highlighted image instead of the Selected+Highlighted image.
(See attached sample project)
Expected Results:
The selected+highlighted image should be displayed.
Actual Results:
The normal+highlighted image is displayed.
Version:
iOS 7.0.1
Notes:
Configuration:
Attachments:
'Segmented Highlight Fail.zip' was successfully uploaded.
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!
We believe this issue has been addressed. Please verify with iOS 8 beta (Build 12A4265u) release, and reply back with your results.
iOS 8 beta (Build 12A4265u) https://developer.apple.com/devcenter/ios/index.action Posted Date: June 2, 2014
If this issue is still occurring, please include any relevant logs, and or a test case with your update.
Logging Instructions/Test Case Requirements: https://developer.apple.com/bug-reporting/ios/
duped as rdar://17036128