Autolayout 16:9 animated GIF in Storyboard Xcode 10, iOS

大兔子大兔子 提交于 2019-12-13 03:49:04

问题


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.

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

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


回答1:


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

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



来源:https://stackoverflow.com/questions/53484198/autolayout-169-animated-gif-in-storyboard-xcode-10-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!