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