View Y-value problem for controller wrapped by navigation controller

Source: Internet
Author: User

Recently has been struggling with the problem, why sometimes the controller's view of the navigation controller's Y value is sometimes 64, sometimes 0, feel very strange, so studied, found that there is a property can change the value of the view Y, that is translucent (belongs to the navigation bar) This property can set the Y value, which is used to set whether the navigation bar is translucent, the default is yes (translucent effect), no is opaque, shows the difference between Yes and no:

To disable the Translucent property, you can select the navigation bar in storyboard, and then in attribute inspectors, uncheck the translucent, or the property of the direct navigation bar is no. when translucent is no, the current navigation controller wraps the controller's view with a Y value of 64 and vice versa at 0 . Some people will feel strange, I did not set translucent=no, just use a picture as its background, then the view's Y value becomes the

[[Uinavigationbar appearance] setbackgroundimage:[uiimage imagenamed:@"Nav_bg.png"] forbarmetrics: Uibarmetricsdefault];

In fact, after you set up the picture, the system automatically helps you to set the value of the translucent attribute to no, so that controller's Y value becomes 64.

View Y-value problem for controller wrapped by navigation controller

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.