iOS 6 应用程序 - 如何处理 iPhone 5 的屏幕尺寸? [英] iOS 6 apps - how to deal with iPhone 5 screen size?

查看:30
本文介绍了iOS 6 应用程序 - 如何处理 iPhone 5 的屏幕尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<块引用>

可能的重复:
如何为 iPhone 5 屏幕开发或迁移应用程序分辨率?

我只是想知道我们应该如何处理 iPhone 5 更大的屏幕尺寸.

因为它有更多的像素高度,所以像 GCRectMake 这样使用坐标的东西(并且因为视网膜/非视网膜问题只是将像素加倍)在版本之间不能无缝地工作,就像我们得到 视网膜.

我们是否需要设计两个故事板,就像 iPad 一样?

我个人认为 Apple 不会要求您在每次必须绘制内容时检查屏幕尺寸,就像许多答案所说的那样.iPad 会出现这种情况吗?

解决方案

从我今天的演示中可以看出,所有应用程序将继续在垂直拉伸的屏幕中工作.它们将是黑边的,或者基本上额外的 88 点高度就是黑色.

如果你只打算支持 iOS 6+,那么一定要考虑使用自动布局.它删除了所有固定的布局处理,而是使用约束来布局.没有什么是硬编码的,你的生活会变得更简单.

但是,如果您必须支持较旧的 iOS,那么这实际上取决于您的应用程序.大多数使用标准导航栏和/或标签栏的应用程序可以简单地扩展中间的内容以用完这些额外的点.设置中心内容的自动调整大小蒙版以在两个方向上扩展.

view.autoresizingMask = UIViewAutoresizingFlexibleWidth |UIViewAutoresizingFlexibleHeight;

它开箱即用的表格视图效果很好,但是,如果您的应用使用像素完美的布局来显示内容,那么最好的办法是重新构想内容,以便它可以适应不同的高度.

如果这不可能,那么剩下的唯一选择就是拥有两个用户界面(iPhone 5 之前和 iPhone 5).

如果这听起来很难看,那么您可以使用默认的信箱模型,其中额外的点/像素仅显示为黑色.

编辑

要使您的应用能够在 iPhone 5 上运行,您需要添加启动器图像的 Retina 版本.它应该被命名为 Default-568h@2x.png.而且它必须是视网膜质量 - 这里没有向后兼容性 :)

您也可以从 Xcode 中选择此图像.转到目标,然后在摘要部分下,查找启动图像.图像大小必须为 640x1136 像素.如果对您有帮助,下面是在哪里可以找到它的屏幕截图.

Possible Duplicate:
How to develop or migrate apps for iPhone 5 screen resolution?

I was just wondering with how should we deal with the iPhone 5 bigger screen size.

As it has more pixels in height, things like GCRectMake that use coordinates (and just doubled the pixels with the retina/non retina problem) won't work seamlessly between versions, as it happened when we got the Retina.

And will we have to design two storyboards, just like for the iPad?

I personally don't think Apple will require you to check the screen size every time you have to draw something, like many answers say. Does that happen with the iPad?

解决方案

All apps will continue to work in the vertically stretched screen from what I could tell in today's presentation. They will be letterboxed or basically the extra 88 points in height would simply be black.

If you only plan to support iOS 6+, then definitely consider using Auto Layout. It removes all fixed layout handling and instead uses constraints to lay things out. Nothing will be hard-coded, and your life will become a lot simpler.

However, if you have to support older iOS's, then it really depends on your application. A majority of applications that use a standard navigation bar, and/or tab bar, could simply expand the content in the middle to use up that extra points. Set the autoresizing mask of the center content to expand in both directions.

view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

It works great out of the box for table views, however, if your app used pixel-perfect layout for displaying content, then your best bet would be to re-imagine the content so that it can accommodate varying heights.

If that's not a possibility, then the only remaining option is to have two UIs (pre iPhone 5, and iPhone 5).

If that sounds ugly, then you could go with the default letterboxed model where the extra points/pixels just show up black.

Edit

To enable your apps to work with iPhone 5, you need to add a retina version of the launcher image. It should be named Default-568h@2x.png. And it has to be retina quality - there's no backward compatibility here :)

You could also select this image from within Xcode. Go to the target, and under the Summary section, look for Launch Images. The image has to be 640x1136 pixels in size. Here's a screenshot of where to find it, if that helps.

这篇关于iOS 6 应用程序 - 如何处理 iPhone 5 的屏幕尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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