使标签与另一个标签的右边缘对齐
我的视图中有一个可变长度标题标签,我希望代表计数的第二个标签立即位于其右侧。
我想做 2 个标签的原因是我希望标题被截断超过一定长度,并且计数在省略号后可见。
这种方法是正确的方法吗?或者我应该根据标题长度构建一个字符串?
谢谢
I have a variable length title label in my view, and i would like a second label representing a count to be immediately to it's right.
The reason I'd like to do 2 labels is that I'd like the title to be truncated past a certain length, and the count to be visible after the ellipsis.
Is this approach the right way to do this? Or should i just build a single string based on title length?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我只会使用一个标签并截断代码中的字符串。它只是减少了您需要处理的 IBOutlet,并且如果您将来想要更改字符串的长度,它也会让您变得更容易。
I would just use one label and truncate the string in my code. Its just one less IBOutlet you have to deal with and it will also make it easier if you ever want to change the length of the string in the future.