如何在XCode 6中水平并排放置2个标签?

时间:2023-02-05 06:04:50

This is a result I need:

这是我需要的结果:

如何在XCode 6中水平并排放置2个标签?

Width of labels are not fixed. They may be equal, first may be larger then second, and the second may be larger than first. I have found some solutions in other questions, but it does not satisfy me, because I do not want to add extra views and my widths are not fixed.

标签的宽度不固定。它们可以相等,首先可以大于第二个,第二个可以大于第一个。我在其他问题中找到了一些解决方案,但它并不能让我满意,因为我不想添加额外的视图而且我的宽度不固定。

1 个解决方案

#1


6  

I made some research, and it is still impossible without extra view:-)

我做了一些研究,如果没有额外的观点,它仍然是不可能的:-)

But the simplest way is:

但最简单的方法是:

1. constraints for wrapper:

1.包装器的约束:

如何在XCode 6中水平并排放置2个标签?

2. constraints for embedded views:

2.嵌入式视图的约束:

如何在XCode 6中水平并排放置2个标签?如何在XCode 6中水平并排放置2个标签?

3. The result is following:

结果如下:

如何在XCode 6中水平并排放置2个标签?

如何在XCode 6中水平并排放置2个标签?

#1


6  

I made some research, and it is still impossible without extra view:-)

我做了一些研究,如果没有额外的观点,它仍然是不可能的:-)

But the simplest way is:

但最简单的方法是:

1. constraints for wrapper:

1.包装器的约束:

如何在XCode 6中水平并排放置2个标签?

2. constraints for embedded views:

2.嵌入式视图的约束:

如何在XCode 6中水平并排放置2个标签?如何在XCode 6中水平并排放置2个标签?

3. The result is following:

结果如下:

如何在XCode 6中水平并排放置2个标签?

如何在XCode 6中水平并排放置2个标签?