UIScrollView as view property of UIViewController
| Originator: | evan | ||
| Number: | rdar://10089712 | Date Originated: | 07-Sep-2011 08:32 PM |
| Status: | Behaves Correctly | Resolved: | 09-May-2012 |
| Product: | Product Version: | ||
| Classification: | Reproducible: |
Summary:
When using a UIScrollView as the view property of a UIViewController it is expected that the frame would underlap a translucent status bar and translucent UINavigationBar. However, this is not the case when such a view controller is pushed onto the navigation stack and the status bar and navigation bar translucent properties are changed.
Steps to Reproduce:
1. Subclass UIViewController
__In Interface Builder__
2. Drag out UIScrollView and delete UIView from docs area
3. Wire view outlet to UIScrollView instance
__In implementation__
4. In viewDidLoad make following calls:
[self setWantsFullScreenLayout:YES];
[[[self navigationController] navigationBar] setBarStyle:UIBarStyleBlack];
[[[self navigationController] navigationBar] setTranslucent:YES];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:NO];
5. Push subclassed view controller onto navigation stack (previous navigation bar and status bar translucent properties can be YES or NO, does not matter).
It may be helpful to install a UILabel or other element at (0,0) in UIScrollView to verify that visual element underlaps status and navigation bars
Expected Results:
Any elements at y-coordinates 0 - 64pt should show through translucent bars
Actual Results:
Scroll View's origin is repositioned to (0,64) of UIScreen mainScreen
Regression:
- Have not tested programmatic creation of view interface.
- Have not tested installing subclassed view controller as root view controller of navigation controller
Notes:
I would really like to know if this is "expected" behavior or something else. I cannot find anything in documentation. Best I could find is the document "Adopting a Full Screen Layout for Navigation Views"
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!
09-May-2012 01:26 PM Apple Developer Bug Reporting Team :
Engineering has determined that this issue behaves as intended based on the following information:
This behavior is actually expected. What is being set is the content inset and this is compensated by the content offset so that the top of the scroll view content can actually be seen when it is first pushed onto the navigation controller. The test for this is fairly simple as you observed in your work around. This behavior was provided mostly for UITableView but since UITableView is a UIScrollView it was generalized a bit.
You should be able to scroll under the navigation bar and the status bar if you set the contentSize of the scrollview to something greater than or equal to the height of the screen. Then you set the contentOffset to (0,0).