故事板Xcode 10,iOS中的自动布局16:9动画GIF [英] Autolayout 16:9 animated GIF in Storyboard Xcode 10, iOS

查看:143
本文介绍了故事板Xcode 10,iOS中的自动布局16:9动画GIF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用通用应用,并想添加一些教程.为此,我创建了16:9动画GIF.我想将其放置在顶部/左侧或顶部/右侧.文本和按钮,无论剩余空间如何.

I'm having a Universal app and wanted to add a little tutorial. For that I have created a 16:9 animated GIF. I wanted to position that top/left or top/right. Text and buttons wherever space is left.

图像最初为400x225,但只要保留16:9,我就可以接受任何大小.

The image is initially 400x225, but I can accept any size, as long as 16:9 is kept.

我不知道该如何对齐,以便在手机上使用比iPad上小的矩形.

I cannot figure out, how I could align that so that on phones it uses a smaller rect as on an iPad.

推荐答案

如果我理解正确,则希望UIImageView保持相同的比例.

If I understand correctly, you want the UIImageView to keep the same ratio.

您可以使用约束来做到这一点,这是您应该使用情节提要来实现的方式

You can do it using constraints, here’s how you should do it using your storyboard

如果您想将其粘贴到左上/右上角,还应该在superview的顶部添加一个约束-以便将其粘贴到顶部,并使用前导/尾随将其粘贴到左侧/对

If you want to stick it to the top left/right corner you should also add a constraint to the top of the superview- in order to stick it to the top, and a leading/trailing one to stick it to the left/right

这篇关于故事板Xcode 10,iOS中的自动布局16:9动画GIF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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