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 UIImagePicker Video Recorder
Declared In
UIViewController.h