iOS 为label添加删除线】的更多相关文章

UILabel *testLabel = [[ UILabel alloc] initWithFrame:CGRectMake(, , , )]; testLabel.numberOfLines = ; NSString* strText = @"测试画删除线测试画删除线测试画删除线测试画删除线测试画删除线"; NSMutableAttributedString *content = [[NSMutableAttributedString alloc]initWithString:st…
1.添加删划线方法遇到的问题 -(void)lastLabelDeal:(NSString *)str1 string:(NSString *)str2 label:(UILabel *)label{ NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@  %@",str1,str2]]; [str addAtt…
NSString *oldPrice = [NSString stringWithFormat:@"原价 %@",_item.previousPrice.stringValue]; NSMutableAttributedString *attr = [[NSMutableAttributedString alloc]initWithString:oldPrice]; [attr addAttribute:NSStrikethroughStyleAttributeName value:@…
遇到坑了: NSString *goodsPrice = @"230.39"; NSString *marketPrice = @"299.99"; NSString* prceString = [NSString stringWithFormat:@"%@ %@",goodsPrice,marketPrice]; DLog(@"----打印--%@---",prceString); NSMutableAttributedSt…
项目中的需求~~~~ 商城中物品的一个本身价格,还有一个就是优惠价格...需要用到一个删除线. public class TestActivity extends Activity { private TextView tv; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);…
class Cat(Animal): def __init__(self): import warnings warnings.warn("Cat类带删除线了", DeprecationWarning) def run(self): import warnings warnings.warn("run方法带删除线了", DeprecationWarning)…
UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(20, 60, 100, 30)];    [self.view addSubview:lable];    lable.backgroundColor = [UIColor redColor];    lable.textAlignment = NSTextAlignmentCenter;    NSString *oldPrice = @"¥ 999999";   …
Android: 在 TextView 里使用删除线 分类: Android2014-09-25 13:17 3431人阅读 评论(0) 收藏 举报 以编程的方式添给 TextView 添加删除线: textview.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG); 顺便研究下: TextView.getPaint() : // Returns the base paint used for the text. // Please use thi…
效果显示如下: 只需要子类化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{…
创建自定义子类DeleteLineLabel,继承自UILabel,然后在自定义子类DeleteLineLabel中 方法一(上下文): - (void)drawRect:(CGRect)rect { [super drawRect:rect]; CGContextRef ref = UIGraphicsGetCurrentContext(); //绘制起点 CGContextMoveToPoint(, rect.size.height * 0.5); //绘制终点 CGContextAddLi…