应用的autoLayout约束多个对象 [英] Applying autoLayout constraints to multiple objects

查看:91
本文介绍了应用的autoLayout约束多个对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我玩的autoLayout约束的iOS

I am playing with autoLayout constraints in iOS

我的使用情况是这样,

我会更好地与图像解释

我使用的UITableViewCell自定义单元格,通过自动布局我已经为文本和分频器线以下的限制也听从了自动布局的限制。 现在你可以看到左边的黄色竖条。

I am using a custom cell for UITableViewCell, through autolayout I have set constraints for text and divider line below and they obey autolayout constraints. Now you can see the yellow vertical strip on the left.

我没有设置任何约束,所以当单元格高度是正常的,它涵盖了整个细胞,但当细胞高度的增加,它不增加,并填补了整个细胞。我不能够做出灵活的高度来w.r.t细胞。

我要扩大黄条覆盖整个小区。

I want to expand the yellow strip to cover the whole cell.

那么,如何才能做到这一点。

So how I can achieve this.

推荐答案

您需要限制设置为黄色视图。默认情况下它会在运行时应用自己的约束。

You need to set constraints to the yellow view. By default it would apply its own constraints at runtime.

要黄色的视图中添加顶部,底部,领先和尾随约束。不要添加高度约束。

To the yellow view add TOP , BOTTOM , LEADING , and TRAILING constraint. DO NOT ADD A HEIGHT constraint.

确认顶部和黄观的底部约束固定在单元格的内容视图。

Make sure the TOP and BOTTOM constraints of the yellow view are pinned to the cell's content view.

让我知道,如果它的工作原理。

Let me know if it works.

干杯

这篇关于应用的autoLayout约束多个对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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