I'm trying to layout my UI. I want to do something like this:
I want the label gonna stop if it meet another view like heart button in this case Is there any way or trick to do this ? Thank you so much.
I'm trying to layout my UI. I want to do something like this:
I want the label gonna stop if it meet another view like heart button in this case Is there any way or trick to do this ? Thank you so much.
If i understand you correctly what you need to do is:
1: This to calculate the width of the text lines.
2: Set a line height and line spacing
3: Get label top frame position add each row of text (height + spacing) and see if it intercepts the UIButton
's frame and in that case truncate the line if line is greater than label.minX
position - button.minX
position
I have never done this myself. And as i'm not actually giving you a solution this is not the correct answer. But this is the approach i would have.
Good luck.
Edit:
As @Maddy mentioned, the exclusionPaths
might work. But if you strive for truncating it i don't know if that is the correct approach.