您的位置:首页 > 移动开发 > IOS开发

商品折扣价 下划线不显示问题

2017-06-15 15:06 106 查看
最近搞商城这边,本来之前好好的但是在不同机型下面有的 商品元件的下划线竟然没有了~~

找了好多资料,最后添加了
[attribute addAttribute:NSBaselineOffsetAttributeName value:@(0) range:NSMakeRange(0, length)];
总算解决了

NSString *price = [NSString stringWithFormat:@"¥%.2f
[self.model.MarketPrice floatValue]];
NSUInteger length = [price length];
NSMutableAttributedString *attribute = [[NSMutableAttributedString alloc] initWithString:price];
[attribute addAttribute:NSBaselineOffsetAttributeName value:@(0) range:NSMakeRange(0, length)];
[attribute addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle) range:NSMakeRange(0, length)];
self.delectPrice.attributedText = attribute;


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息