为xcode 7 beta 4图像处理不同iPhone / iPad尺寸的限制 [英] Constraints to take care of different iPhone/iPad sizes for images xcode 7 beta 4

查看:105
本文介绍了为xcode 7 beta 4图像处理不同iPhone / iPad尺寸的限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是iOS开发的新手,所以在Xcode中设置故事板上对象的约束对我来说很难。

I'm new to iOS development, so setting constraints for objects on the storyboard in Xcode has been difficult for me.

如下图所示,我有我在草图中创建的按钮有3个边框,因此它们都是图像,每个图像都在图像视图中:

As this picture below shows, I have 3 borders for buttons I created in sketch so they are all images, each of them inside of a image view:

我尝试通过将所有三个图像固定在左侧,右侧和下方来添加约束,但我得到了错误,并且它在模拟器上根本没有出现。所有图像都处于宽高比填充模式,当我将图像放入故事板时,我的视图大小与iPhone 4相同。以下是iPhone 6模拟器中没有任何限制的示例:

I tried adding constraints by pinning all three images to the left, right and below themselves but I got errors for it and it did not come out right at all on the simulators. All of the images are in aspect fill mode, and I have the view in the size of an iPhone 4 when I put the images in the storyboard. Here's an example of what it looks like in the iPhone 6 simulator without any constraints:

我需要什么样的约束才能让所有iPhone和iPad尺寸看起来都合适,看起来就像在故事板中一样?横向模式不会成为此应用程序的一部分,因此不需要考虑。

What are the constraints I need so that it looks okay for all iPhone and iPad sizes and looks like it does in the storyboard? And landscape mode will not be a part of this application, so that will not need to be accounted for.

推荐答案

你也可以使用按钮1等宽约束
和按钮2等宽约束

You can also use button 1 equal width constraint and button 2 equal width constraint

更多细节 http://www.raywenderlich.com/83129/beginning-auto-layout-tutorial-swift-part -1

< img src =https://i.stack.imgur.com/BOO8w.pngalt =在此输入图像说明>

这是你的要求???

这篇关于为xcode 7 beta 4图像处理不同iPhone / iPad尺寸的限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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