Get the controller's view to the top of the screen, which is underneath the status bar

Source: Internet
Author: User

This code can be the view top to the status bar to stick to the top of the screen


This code will also be the view top to the bottom, so if the project is developed with Tabbarcontroller

TableView below the total display is not complete, with code to set the offset is useless;

The official documentation is explained as follows: A Boolean value that indicates whether the view controller should automatically adjust its scroll view insets. Declarationswiftvar Automaticallyadjustsscrollviewinsets:boolobjective-c@property (nonatomic, assign) BOOL Automaticallyadjustsscrollviewinsetsdiscussionthe default value of this property is YES, which allows the view controller To adjust their scroll view insets in response to the screens areas consumed by the status bar, navigation bar, and toolbar O R Tab Bar. Set to NO if you want to manage scroll view inset adjustments yourself, such as when there are more than one scroll view in The view hierarchy. Availabilityavailable in IOS 7.0 and later. The simple point is that Automaticallyadjustsscrollviewinsets is based on the status bar at the interface, Navigationbar, with Tabbar height, automatically adjusts ScrollView inset, sets to No, does not let Viewcontroller adjust,

Therefore, in order to avoid the problem can be manually set the Contentinset can also achieve the same effect;

Get the controller's view to the top of the screen, which is underneath the status bar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.