iOS 8.1 | Loading text view from xib and shrinking view leads to unwanted content offset

Originator:igeek1
Number:rdar://19081060 Date Originated:25-Nov-2014 04:51 PM
Status:Open Resolved:
Product:iOS Product Version:iOS 8.1 (12B411)
Classification:Serious Bug Reproducible:Always
 
Summary:
Putting a UITextView in a xib, loading it with long text, and presenting it such that its view is smaller than it was in the xib results in a vertical offset of the text view.

Steps to Reproduce:
1. Open the attached sample project.
2. Run it, and observe that the text view’s text starts at line 12, because the lines before that are scrolled off the top.
3. To see my workaround, open ModalViewController.m and go to line 39. Change the NO to a YES and re-run. Observe that the text view’s text starts at line 0, which is expected.

Expected Results:
Setting up a text view and setting its text, as in the “async = NO” case in the sample project, starts the text view scrolled to an offset of (0,0) unless otherwise specified.

Actual Results:
The text view starts out scrolled down a bit, unless the dispatch_async workaround is applied.

Regression:
Unknown.

Notes:
This occurs only if the view controller returns a size from -preferredContentSize that is smaller than the size specified in the xib, which is common for flexible UIs and/or xibs that are set to “Inferred” size.

Attachments:
Sample project: http://cl.ly/Yhvv

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!