iOS · UILabel加删除线】的更多相关文章

创建自定义子类DeleteLineLabel,继承自UILabel,然后在自定义子类DeleteLineLabel中 方法一(上下文): - (void)drawRect:(CGRect)rect { [super drawRect:rect]; CGContextRef ref = UIGraphicsGetCurrentContext(); //绘制起点 CGContextMoveToPoint(, rect.size.height * 0.5); //绘制终点 CGContextAddLi…
遇到坑了: NSString *goodsPrice = @"230.39"; NSString *marketPrice = @"299.99"; NSString* prceString = [NSString stringWithFormat:@"%@ %@",goodsPrice,marketPrice]; DLog(@"----打印--%@---",prceString); NSMutableAttributedSt…
效果显示如下: 只需要子类化Label,重写DrawRect()方法即可: #import "MyLabel.h" @implementation MyLabel - (instancetype)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if (self) { } return self; } //重写UILabel的drawRect类 - (void)drawRect:(CGRect)rect{…
NSString *oldPrice = [NSString stringWithFormat:@"原价 %@",_item.previousPrice.stringValue]; NSMutableAttributedString *attr = [[NSMutableAttributedString alloc]initWithString:oldPrice]; [attr addAttribute:NSStrikethroughStyleAttributeName value:@…
1.添加删划线方法遇到的问题 -(void)lastLabelDeal:(NSString *)str1 string:(NSString *)str2 label:(UILabel *)label{ NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@  %@",str1,str2]]; [str addAtt…
有的朋友在制作网站的时候,需要给字体制作删除线,例如:选择题,错误标识等!那么我们就需要用到了<s>这个标签写法如下 字体删除线: <s>这里是内容</s> 效果如下:未加删除线  加了删除线 当我们在<s>标签里面加入了删除线文字中间就会出现一横线,这就是删除线的效果…
UILabel *valueL = [JAppViewTools getLabel:CGRectMake(JFWidth(15), CGRectGetMaxY(proName.frame)+JFWidth(12), KSCreenWidth-JFWidth(30), JFWidth(14)) :JTextFCMake(JFFont(15), rgb(28, 218, 159))]; valueL.text = [NSString stringWithFormat:@"%@ 金币 ¥%@"…
iOS 6 中苹果引入了 NSStrikethroughStyleAttributeName 属性,用于设置 NSAttributedString 的删除线样式,用法如下: let attributedText = NSAttributedString(string: "内容", attributes: [NSStrikethroughStyleAttributeName: 1]) let contentLabel = UILabel() contentLabel.attributed…
UILabel *testLabel = [[ UILabel alloc] initWithFrame:CGRectMake(, , , )]; testLabel.numberOfLines = ; NSString* strText = @"测试画删除线测试画删除线测试画删除线测试画删除线测试画删除线"; NSMutableAttributedString *content = [[NSMutableAttributedString alloc]initWithString:st…
更新时间:2019.09.14 1. 序言 有时候,我们需要对某些文字进行强调,例如粗体和斜体.而Markdown通常可以使用星号*或者下划线_进行文字强调. 2. 加粗 如果想要达到加粗的效果,可以使用一组**和__包围着你想加粗的内容,例如**加粗**或者__加粗__--->效果:加粗或者 加粗 ps:在博客园中如果使用__加粗__,而前面紧跟着文字时并不会生效,需要加一个空格才行.但如果前面是符号,则能够正常显示. 例:我想__加粗__(前面没有加空格),我想(没有加空格)加粗,我想 加粗…