Reading intrinsicContentSize value of UISegmentedControl should not cause control to resize.

Originator:oliver
Number:rdar://15358399 Date Originated:31-Oct-2013 12:10pm
Status:Open Resolved:
Product:iOS SDK Product Version:7.0.2/11A501
Classification:Other Bug Reproducible:Always
 
Summary:
Reading the intrinsicContentSize property of a UISegmentedControl causes that control to resize visually even if that control has a layout constraint that forces the height to be greater than the intrinsic content size.

Steps to Reproduce:
1. Add a UISegmentedControl as a subview.
2. Add an NSLayoutConstraint that pins its height to 60 points.
3. Call intrinsicContentSize
4. The returned size is smaller than 60 points high (this is expected, because the intrinsic content is smaller)
5. The on screen size of the control (and frame property of the UIView) will have changed (this is unexpected).

If you then call setNeedsLayout on the superview of the UISegmentedControl the UISegmentedControl will return to the size specified by its height constraint.

The attached sample app shows this bug.

Expected Results:
That the layout size of the UISegmentedControl is not changed by the read only intrinsicContentSize property.  This method should have no side effects.

Actual Results:
The layout and frame of the UISegmentedControl changes when reading intrinsicContentSize.  This behaviour seems to be in both iOS 6.x and 7.x.

Version:
7.0.2/11A501

Notes:


Configuration:


Attachments:
'Test3.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!