Problems with TopLayout and SuperView in storyBoard,

Source: Internet
Author: User

Problems with TopLayout and SuperView in storyBoard,
Problems in Automatic Layout of Storyboard

During project creation, a page is required to hide the Nav. tableView is laid out from the top of the status bar. However, during the automatic layout process, tableView is always laid out from the bottom of the statusBar (the top is always not covered by the status bar ). Later I found the problem and found a solution.

Let's talk about my solution first.

1. On the storyboard, select viewController and find the "Adjust Scroll View Insets" option in the right attribute bar. deselect this option.
2. When adding constraints to the tableview Layout, click the downward arrow next to the value and select View (current distance = 0). Do not select Top Layout Guide (current distance = 0 )"

About Top Layout Guide and Bottom Layout Guide

In the original Automatic layout, you can choose whether your constraints are based on superview or layout guide. Layout guide is described as follows:

Top Layout Guide is used to assist in Automatic Layout. On the Storyboard, you can see that Top Layout Guide is an attribute of ViewController, that is, topLayoutGuide. The Discussion of this attribute is as follows:
The topLayoutGuide attribute indicates the highest position of the content range that is not blocked by the transparent status bar or navigation bar. The value of this attribute is the value of its length attribute (topLayoutGuide. length). This value may be determined by the current ViewController or the NavigationController or TabBarController to which the ViewController belongs, as follows:
An independent ViewController that does not contain any other ViewController. If the status bar is visible, topLayoutGuide indicates the bottom of the status bar; otherwise, it indicates the top edge of the ViewController.
ViewController included in other viewcontrollers does not determine this attribute, but its meaning is determined by the container ViewController:
If the Navigation Bar is visible, topLayoutGuide indicates the bottom of the Navigation Bar.
If the status bar is visible, topLayoutGuide indicates the bottom of the status bar.
If not visible, it indicates the top edge of ViewController.
This part is easy to understand. In short, it is the bottom of any column on the top of the screen that blocks content.

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.