英文:
Set alignment for one member in the stackView
问题
我有一个包含三个项目的堆栈视图,其中有2个标签(一个位于左侧,另一个位于右侧),以及一个视图作为中间的分隔符。
堆栈视图的配置应该是这样的,使分隔符具有左对齐。
我的意思是,分隔符应该离左侧项目更近,而不是右侧项目。
感谢您的帮助。
英文:
I have a stack view that contains three item, 2 labels (one of them in the left side and another one in the right side), and one view as a separator in the middle.
How the configuration of the stackView should look like that the separator has a left alignment.
I mean the separator should stay closer to the left item than the right one.
your help will be appreciated.
答案1
得分: -3
给分隔符一个固定宽度,并在分隔符后面的堆栈中添加另一个空的 UIView()
,该视图将覆盖剩余的空间。这样,您的右侧标签将保持在右侧,而左侧标签与分隔符对齐在左侧。干杯
英文:
Give separator a fix width and add another empty UIView()
in the stack after separator which will cover the remaining space. This way your right label stay on right and left label with separator aligns left Cheers
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论