Ios6/ios7 status bar height adaptation

Source: Internet
Author: User

Problem reason: The status bar of IOS7 no longer occupies a separate 20px, so assuming that your interface layout on iOS6 is normal, then the iOS7 will look like the following:


On the left is the IOS6 interface layout, and the right is the IOS7 interface layout. Then someone would want to move the controls on the IOS7 interface down by 20px, but when the interface Builder document was changed to Xcode 4.6, it turned out to be something like the following:


The interface will not be different because you set different layouts under different interface Builder document values, so you must use the iOS 6/7 deltas mechanism of Xcode 5.

If you were previously based on an app developed by IOS6, and the layout is correct, go to the Size Inspector page of the control to set the iOS 6/7 deltas property.

Since we do a highly adaptable, so we use the Y and height two values, we are now based on iOS6 to adapt to iOS7, so 6 is correct, 7 of the layout will be with the status bar overlap, so the view and TableView y value should be set to 20, That is, when the 6 layout is displayed on 7, the y-coordinate moves down by 20px so that it does not overlap the status bar. But the overall move down the 20px,tableview bottom 20px area will not be able to display, so this time to set the height of the TableView is 20, that is, when displayed on 7, the height of the tableview to reduce 20px, To make TableView all appear in the screen. The interface Builder document is changed to Xcode 5 discovery, the interface is displayed normally, the iOS 6/7 deltas value of each control is viewed, and it is found to be the opposite of the value set under Xcode 4.6, assuming that the iOS6 layout is changed based on the iOS7 layout. You should set Y to a negative value so that the control moves up the corresponding height when it is displayed on the iOS6.

Finally the effect:





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.