iOS 改变UILabel部分颜色
ios 部分 改变 颜色 UILabel
2023-09-27 14:21:33 时间
//协议
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];
相关文章
- IOS 面试 --- 网络部分
- iOS-为方便项目开发在pch加入一些经常使用宏定义
- iOS 14 egret H5游戏卡顿问题分析和部分解决办法
- iOS 防 DNS 污染方案调研 --- 302等 URL 重定向业务场景
- iOS项目中集成Flutter的最新适配升级
- iOS 输入时键盘处理问题
- iOS Assigning to 'id<XXXDelegate>' from incompatible type 'BViewController *__strong'
- IOS iphone 4inch上应用没有全屏,上下有黑边
- iOS中 蓝牙2.0详解/ios蓝牙设备详解 韩俊强的博客
- 无障碍开发(十四)之Android /iOS平台无障碍功能
- IOS总结_无需自己定义UITabbar也可改变UITabbarController的背景和点击和的颜色
- iOS 开发者一定要知道的 14 个知识点
- 用脚本来简化iOS美术同学的工作
- iOS图片压缩上传
- iOS自定义控件开发详解
- ios页面跳转基础