使用自动布局根据方向在行或列中显示两个视图 [英] Display two views in a row or column depending on orientation using AutoLayout

查看:58
本文介绍了使用自动布局根据方向在行或列中显示两个视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个相当简单的问题,但我无法自己解决:

A fairly simple question but I'm unable to work it out for myself:

鉴于下面显示的布局,我希望两个容器保持它们的大小(270x270点),但以横向显示它们.我需要什么约束?我尝试对它们使用左/右边距约束和固定大小,但不起作用.

Given the layout displayed below I want the two container to maintain their size (270x270 points) but display them in a row for landscape orientation. What constraints do I need? I tried using the left / right margin constraints and fixed size for both of them but it does not work.

有什么想法吗?

推荐答案

尝试同时设置它们的高度和宽度.顶部和左侧为顶部框.底部框的底部和右侧.

Try height and width for both of them. Top and left for the top box. Bottom and Right for the bottom box.

这篇关于使用自动布局根据方向在行或列中显示两个视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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