简体   繁体   English

Xcode自动布局-动态约束

[英]Xcode autolayout - dynamic constraints

In the picture below you can see "prototype" of menu I need to create. 在下面的图片中,您可以看到我需要创建的菜单的“原型”。

在此处输入图片说明

I managed to do it with only single item in the middle, but how can I achieve exactly the same result as you can see in the picture ? 我设法只在中间放置了一个物品,但是如何获得与您在图片中看到的完全相同的结果?

Each circle should be a separate element. 每个圆圈应该是一个单独的元素。

If I have understood your problem, then following is the solution. 如果我了解您的问题,那么下面是解决方法。

Add following constraints as shown in screenshot, I have also included result achieved in simulator with these constraints in screenshot. 如屏幕快照中所示添加以下约束,我还将这些约束包含在模拟器中实现的结果。

And for setting borderWidth and corner radius I have used run time attributes which is also shown in screenshot. 为了设置borderWidth和转角半径,我使用了运行时属性,该属性也显示在屏幕截图中。

Edit- Added new ScreenShot. 编辑-添加了新的ScreenShot。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM