Open ShouBinCheng opened 5 years ago
NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:self.model.describe]; text.yy_font = [TXSakura getFontWithPath:@"m.16"] ?: [UIFont systemFontOfSize:16]; text.yy_color = [TXSakura getColorWithPath:HomeTheme.textColorMain]; text.yy_lineBreakMode = NSLineBreakByTruncatingMiddle; YYTextContainer *container = [YYTextContainer containerWithSize:CGSizeMake(LBConst.screenWidth-40, INT_MAX)]; container.maximumNumberOfRows = 4; YYTextLayout *textLayout = [YYTextLayout layoutWithContainer:container text:text];
设置text.yy_lineBreakMode = NSLineBreakByTruncatingMiddle; 后label只展示一行,怎么让它展示设定的最大行数
text.yy_lineBreakMode = NSLineBreakByTruncatingMiddle;
不要用这种方式设置。 直接用label或者container, 不过middle模式有点问题,目前我也还在找答案
找到了一个方案 https://www.jianshu.com/p/f87b07668740
设置
text.yy_lineBreakMode = NSLineBreakByTruncatingMiddle;
后label只展示一行,怎么让它展示设定的最大行数