Storyboard app run on iOS 7 OK but Navbar shift view on iOS 6.1

﹥>﹥吖頭↗ 提交于 2019-12-12 07:47:05

问题


While rebuilding my project with the new Xcode 5 released yesterday, I was disappointed to see my storyboard view controller shaken up.

After many attempts to fix things, I must conclude I'm stuck with one remaining issue: Navigation View Controller makes the navigation bar overlaps with the content of the view. Doing so, the app is ok on a iOS 7 device (no overlapping), but with a iOS 6.1 device, the navbar overlaps.

I ran a sample project from FlatUI to crosscheck the issue, and they have the same issue. Any idea please?


回答1:


You are facing problem because of co-ordinate system, co-ordinate system of iOS 6 & iOS 7 are different iOS 7 Uses by default translucent properties.

Try putting this Code in viewDidLoad

if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1)
{
     self.edgesForExtendedLayout=NO;
}



回答2:


I think this is because of co-ordinate system of iOS 6 & iOS 7

Kindly check following two images.

iOS 6:

iOS 7 :




回答3:


As I said in the comment: in IB (interface builder), you need to go to the "Attribute Inspector" for the view controller, and look at the "Extend Edges" attribute: simply uncheck the "Under Top Bar" flag and you're done.




回答4:


In interface builder, in the size inspector tab, there is a section called iOS 6/7 Delta where you can fix navigation bar issue or when some control have different size in ios7 than in ios6.




回答5:


You have to do two things :-

a. select that particular xib or view in storyboard and see on right pane there is extended edges option unlcik first option. now this would shift your view down perfectly.

b.all the contents inside this view will also get shifted below for that you have to set delta factor -(x pixels) for ios7 and +(pixels) for ios6. For setting 6 and 7 you have to select "view as" option in right pane of xib.

Happy coding



来源:https://stackoverflow.com/questions/18749499/storyboard-app-run-on-ios-7-ok-but-navbar-shift-view-on-ios-6-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!