I’ve found a solution with GTMFadeTruncatingLabelTest from GoogleToolboxForMac but don’t really understand how to use it and I don’t find anything about it
but if you have another solution besides of this one
If you can’t help me with GoogleToolboxForMac feel free to suggest other solution
Should kinda look like this at the end:
2
Answers
I am not sure about the GTMFadeTruncatingLabelTest but I can offer an alternative solution.
Steps
Implementation
If you don’t want to read the rest, just grab the code from this repo
I wrapped step 1, 2 and 3 from above in a custom UILabel subclass. The reasoning is explained in the comments.
Then you can use it like a regular UILabel, for example:
Output
Limitation
This way only supports single line UILabels
Update
Added a function to remove the default truncation method of using ellipsis (three dots) by UILabel with this function.
This function has been updated in the original code and repo mentioned above.
I Think the easiest way is to use the following code:
It automatically fades the last words if applicable and text size has more width than UILabel!
thanks to thi