I have two UILabels, one above the other.
The top one has fixed size (2 Lines), and the bottom one can expand (0 lines).
The text which I using for the labels can be short and sometimes it can be very long.
How can I calculate the first UILabel max string length without cut a word in the middle?
//Here is the code which create the 2 labels.
titleView = [[UILabel alloc] initWithFrame:CGRectMake(70, 0, 200, 50)];
titleView.numberOfLines = 2;
titleView2 = [[UILabel alloc] initWithFrame:CGRectMake(20, 50, 250, 100)];
titleView2.numberOfLines = 0;
I’ve solved the problem with this method: