[iOS diary]關於UIViewController裡面的他的內建屬性view的位置與navigationBar和statusBar的關係

來源:互聯網
上載者:User

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



相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.