weijentu / automatic-height-tagcells

This is a sample project to implement features with dynamic height of UITableViewCell based on autolayout, tags aligned automatically and clickable tags.
http://www.xcodeproj.com
MIT License
225 stars 36 forks source link

The tag is chopped if it's wider than the width of the display #9

Open tciuro opened 7 years ago

tciuro commented 7 years ago

If you have a long enough string, the tag's right side will be chopped off. Consider filling the tag as much as the display's width and add an API to allow to set the ellipsis (using NSLineBreakMode). Something like:

 /* An initialization sample of AHTag with Objective-C */
AHTag *tag = [AHTag new];
tag.category = @"Genre";
tag.title = @"This is a really, really long string that probably won't fit in the tag";
tag.color = [UIColor colorWithRed:1 green:0.56 blue:0.56 alpha:1];
tag.url = [NSURL URLWithString:@"http://www.coldyam.com"];
tag.enabled = @YES;
tag.lineBreakMode = NSLineBreakByTruncatingMiddle;

That would make the tag look great. Thank you!

weijentu commented 7 years ago

@tciuro It's surprising to me that the issue is more complicated than I thought. During my workaround, I had a weird drawing results in tags. Anyway, I take an experimenting approach in the branch: TruncatingTail to solve the issue. Because I'm not very satisfied in the approach, I'll put it as a branch until I can get a better solution.

Cheers,

tciuro commented 7 years ago

I tried to fix it, but started to go down the proverbial rabbit hole. Thanks for trying to address it!