Question

If I set linebreakmode to truncation tail in the TTTAttributedLabel Example App "Espresso" everything looks like it should be in iOS 5 Simulator but if I run the App in iOS 6 Simulator the text gets truncated after the first line although the text goes over 3 lines. Number of lines are set to zero. Did I miss something? After I noticed this behavior in the Espresso App I can stop worrying about the brokeness of the code in my own app. Any suggestions? Thanks!

Was it helpful?

Solution 4

Strangely the problem solved itself. I could not figure out why this particular problem happened on iOS6 Simulator but now it works with NSLineBreakTailTruncation on iOS6 Device and Simulator.

Thank you for your responses!

OTHER TIPS

I currently faced the same problem. Try setting the LineBreakMode before you actually set your text. E.g.:

TTTAttributedLabel* descriptionLabel = [[TTTAttributedLabel alloc] initWithFrame:CGRectMake(20, 120, 280, expectedSize.height)];
descriptionLabel.lineBreakMode = UILineBreakModeWordWrap;
descriptionLabel.numberOfLines = 0;
descriptionLabel.text = description;

Labels and textviews in iOS 6 support attributed text natively. So if you don't need to support older versions of iOS, you can get rid of 3rd party control.

In my case, for some reason following code was causing the label to show only one row. Removing it helped ' self.attributedLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;'

You can have a try.

NSMutableAttributedString * mutableAttributedString = [[NSMutableAttributedString alloc]initWithString:text]; [self.attributedLabel setText:mutableAttributedString afterInheritingLabelAttributesAndConfiguringWithBlock:nil];

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top