zoukankan      html  css  js  c++  java
  • iOS 改变UILabel部分颜色

     //协议

        UILabel *xieLabel = [[UILabel alloc] init];

        xieLabel.textColor = TextGrayColor;

        xieLabel.font = [UIFont systemFontOfSize:12];

        NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:@"我已阅读并同意《存工资服务协议》"];

        [string addAttribute:NSForegroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, 7)];

        [string addAttribute:NSForegroundColorAttributeName value:[UIColor orangeColor] range:NSMakeRange(7, string.length - 7)];

        xieLabel.attributedText = string;

        xieLabel.userInteractionEnabled = YES;

        UITapGestureRecognizer *xieyitap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(xiyiAction)];

        [xieLabel addGestureRecognizer:xieyitap];

  • 相关阅读:
    token
    跨域问题???
    简单使用express
    深拷贝 浅拷贝
    node表单提交初知识!
    11.29
    11.28
    11.27
    11.26每日总结
    11.25每日总结
  • 原文地址:https://www.cnblogs.com/iOS-mt/p/6043136.html
Copyright © 2011-2022 走看看