uiviewController.view是由UIViewController初始化并赋值,同时对这个view做了一些特殊的改动。
在iOS6中通过默认设置wantFullScreenLayout = False;所以,他会把这个view.origin.y = statusBar.height + navigationBar.height;
wantsFullScreenLayout的属性已被抛弃
automaticallyAdjustsScrollViewInsets的属性在iOS7中启用
在iOS7中通过设置automaticallyAdjustsScrollViewInsets = True,所以,他会将所有的scrollView的contentOffset都下移64个像素,也就是statusBar.height + navigationBar.height。
所以,通过设置这两个属性可以确定其viewController.view以及其子View的位置。
疑问,话说,wantsFullScreenLayout这个属性在iOS7中被抛弃是什么意思,是不起作用的意思吗?
wantsFullScreenLayout
A Boolean value indicating whether the view should underlap the status bar. (Deprecated in iOS 7.0.)
@property(nonatomic, assign) BOOL wantsFullScreenLayout
Discussion
When a view controller presents its view, it normally shrinks that view so that its frame does not overlap the device’s status bar. Setting this property to YES causes the view controller to size its view so that it fills the entire screen, including the area under the status bar. (Of course, for this to happen, the window hosting the view controller must itself be sized to fill the entire screen, including the area underneath the status bar.) You would typically set this property to YES in cases where you have a translucent status bar and want your view’s content to be visible behind that view.
If this property is YES, the view is not resized in a way that would cause it to underlap a tab bar but is resized to underlap translucent toolbars. Regardless of the value of this property, navigation controllers always allow views to underlap translucent navigation bars.
The default value of this property is NO, which causes the view to be laid out so it does not underlap the status bar.
Availability
- Available in iOS 3.0 and later.
- Deprecated in iOS 7.0.
Related Sample Code
Declared In
UIViewController.h