【问题标题】:How can i design Single xib for iphone3.5,and iphone 4 inch screen (ios6 and ios7)?如何为 iphone 3.5 和 iphone 4 英寸屏幕(ios 6 和 ios7)设计 Single xib?
【发布时间】:2013-10-22 13:13:16
【问题描述】:

我将我的应用程序创建为带有 iphone 屏幕的标签栏应用程序。它在早期工作得很好。现在我想更改我的标签栏应用程序以支持 iphone3.5 和 4 英寸屏幕(在 ios6 和 ios7 中)。在过去,我为此只设计了一个 xib。

是否可以使用单个 xib 支持所有这些屏幕?请帮我解决这个问题。

注意事项:

我有最新的 xcode5。我试过 autoresizing ,但很难理解。因为它在 ios6 中适用于 3.5 英寸屏幕和 4 英寸屏幕,但在 ios7 中视图超出了屏幕。

【问题讨论】:

  • 无论屏幕大小如何,您都可以使用自动布局来正确放置 UI 元素。这里有一个很好的教程:raywenderlich.com/20881
  • @Heliem 解决方案可以实现

标签: iphone ios ios7 xcode5


【解决方案1】:

这不是因为尺寸。

在 iOS7 中,顶部和底部栏都是透明的。这就是您的视图被调整大小并被栏覆盖的原因。

要解决这个问题,只需将此行添加到您的 viewDidLoad 方法中:

if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)])
    self.edgesForExtendedLayout = UIRectEdgeNone;
if ([self.tabBar respondsToSelector:@selector(setTranslucent:)])
    self.tabBar.translucent = NO;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-03-30
    • 2014-09-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多