如何使.xib文件与iOS7,iOS6和更早版本兼容 [英] How to make .xib files compatible to both iOS7, iOS6 and earlier

查看:63
本文介绍了如何使.xib文件与iOS7,iOS6和更早版本兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用.xib文件,并且在使用xcode5。

I am using .xib files in my app and I am using xcode5.

如果我在iOS6和更早版本中运行我的应用程序,对齐方式将丢失。

If I run my app in iOS6 and earlier, the alignments are missing.

任何人都知道这一点问题?

我们必须为iOS7和iOS6创建单独的.xib文件吗?

Any one know about this issue?
Do we have to create separate .xib files for iOS7 and iOS6?

编辑:我关闭了自动布局功能,但在iOS6下,视图仍下降了20个像素。

I turned off Autolayout but under iOS6, the views are still going down by 20 pixels.

推荐答案

在iOS7中,应用程序窗口从y = 0px开始(在iOS6-中,从y = 20px开始)。

in iOS7, the app windows starts from y=0px (in iOS6-, it begins at y=20px).

处理此问题的最快,最简单的方法(,因为您已经在使用Xcode5 ),是关闭自动版式并利用每个视图的 iOS6 / 7 Delta 值。

The quickest and easiest way to handle this, (and since you're already using Xcode5), is to switch off Autolayout and utilize the iOS6/7 Delta values for every view.

基本上:


  • 选择每个 viewController 的主视图,然后取消选中 使用自动版式

  • 选择每个 subView UIButton UILabel 等) ,请转到框架设置部分

  • Select every viewController's main view and uncheck "Use Autolayout"
  • Select every subView (UIButton, UILabel etc), go to the frame setting section

  1. 将其Y框架值增加20


    • 但似乎,@ SudhakarTharigoppula,不需要执行此步骤。

      ...只需执行下一步

  1. Increase their Y frame values by 20
    • but it seems you, @SudhakarTharigoppula, don't need to do this step.
      ...just do the next step

输入值-20

这将通过在iOS7中保留20px来启动您的应用,但在iOS6中,-20px的ΔY将补偿您为每个 subView 额外分配了20px。

This will start your app by leaving 20px in iOS7 but back in iOS6, the ΔY of -20px will compensate for the extra 20px you had given to every subView.

请参阅: IOS7中的状态栏和导航栏问题

这篇关于如何使.xib文件与iOS7,iOS6和更早版本兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆