ibireme / YYText

Powerful text framework for iOS to display and edit rich text.
MIT License
8.86k stars 1.7k forks source link

显示超出 label 大小的文字截断有问题 #339

Open ufosky opened 8 years ago

ufosky commented 8 years ago

下面是分别用 UILabel 和 YYLabel 实现的显示效果。 代码:

  UILabel *l1 = [UILabel new];
  l1.numberOfLines = 1;
  l1.frame = CGRectMake(0, 64, 320, 20);
  l1.lineBreakMode = NSLineBreakByTruncatingTail;
  l1.text = @"[草稿]aaaaaassssdfsdfsdfrgrehbgfbhthrtrhtfhdyhytjyhftrfgdrgdegrdfrdffdgd";
  [self.view addSubview:l1];

  YYLabel *l2 = [YYLabel new];
  l2.numberOfLines = 1;
  l2.frame = CGRectMake(0, 84, 320, 20);
  l2.lineBreakMode = NSLineBreakByTruncatingTail;
  l2.text = @"[草稿]aaaaaassssdfsdfsdfrgrehbgfbhthrtrhtfhdyhytjyhftrfgdrgdegrdfrdffdgd";
  [self.view addSubview:l2];

效果: 5288f5ab-fefe-494f-83a5-1c8d99bd6461

ibireme commented 8 years ago

换行时,后面那串字母被视为一个英文单词进行短行,所以被裁剪掉了。 这块儿稍后做一下优化,尽量兼容 UILabel。

fishofeyes commented 3 months ago

还没有修复么?