简体   繁体   中英

Make label snap to the right edge of another label

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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