如何调整iPhone 5的应用程序大小? [英] How to resize App for Iphone 5?

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

问题描述

我正在创建一个通用应用。在ipad / iphone上看起来很棒但是当我将故事板视图切换到iphone 5或者将模拟器作为iphone 5运行时,只有空白的底部有一英寸左右。我试过打开autolayout并使用它,但没有运气。我还试图创建我的图像的-568h@2x.png版本,以查看它是否会自动调整大小,但事实并非如此。有没有人可以尝试其他任何想法?

I'm creating a universal app. Everything is looking great on the ipad/iphone but when I switch my storyboard view to the iphone 5 or run the simulator as the iphone 5, there is an inch or so at the bottom of just whitespace. I've tried turning on autolayout and using that, but with no luck. I've also tried to create -568h@2x.png versions of my images to see if it will auto-resize with those, but it doesn't. Does anyone have any other ideas I could perhaps try?

谢谢!

推荐答案

我发现解决这个问题的方法是在Xcode中使用尺寸检查器中的AutoResizing框。这是红线框。它旁边的红色框会显示动画,以便在视图(白框)改变大小时显示它是如何变化的。这会更改故事板中的autoresizingMask。您可以使图像缩放或不与边缘保持距离:只需单击不同的红线即可查看红色框的变化情况。我必须为游戏中的每个按钮和图像执行此操作。

I found the way to fix this was to use the AutoResizing box in the size inspector in Xcode. It's the box with the red lines. The red box next to it animates to show you how it changes as the view (the white box) changes size. This changes the autoresizingMask in the storyboard. You can make the image scale or not or keep distance to an edge: Just click on the different red lines to see how the red box changes. I had to do this for every button and image in the game.

您还需要在属性检查器的父视图中选中自动调整子视图。

You also need to check 'Autoresize Subviews' in the parent view in the Attributes Inspector.

你需要Default-568h@2x.png才能摆脱信箱。

And you do need Default-568h@2x.png to get rid of the letterbox in the first place.

这篇关于如何调整iPhone 5的应用程序大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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