使用NSMutableAttributedString 给UILable加删除线
2015-10-19 11:59
543 查看
NSString *oldPrice =
@"¥ 8.0全价";
NSMutableAttributedString *attri = [[NSMutableAttributedString
alloc] initWithString:oldPrice];
[attri addAttribute:NSStrikethroughStyleAttributeName
value:@(
NSUnderlineStyleThick)
range:NSMakeRange(0, length)];
[attri addAttribute:NSStrikethroughColorAttributeName
value:[UIColor
redColor] range:NSMakeRange(0, length)];
[contentLab
setAttributedText:attri];
@"¥ 8.0全价";
NSMutableAttributedString *attri = [[NSMutableAttributedString
alloc] initWithString:oldPrice];
[attri addAttribute:NSStrikethroughStyleAttributeName
value:@(
NSUnderlineStyleThick)
range:NSMakeRange(0, length)];
[attri addAttribute:NSStrikethroughColorAttributeName
value:[UIColor
redColor] range:NSMakeRange(0, length)];
[contentLab
setAttributedText:attri];
相关文章推荐
- 让zepto支持requirejs的方法
- 范围最小值问题 (Range Minimum Query,RMQ)
- UI星辰:疯狂食材总结
- QtCreator创建的GUI Project工程文件介绍
- 根据GUID类别获取设备信息
- 【IOS 开发学习总结-OC-57】★UI之UICollectionView 与UICollectionViewController
- iOS8统一的系统提示控件——UIAlertController
- UIRefreshControl(下拉刷新系统控件)
- getRequestURI,getRequestURL的区别
- iOS 约束 自动布局 UI
- SPOJ GSS6 Can you answer these queries VI
- SharePoint 2013 IT Professional--如何配置Access Request Setting
- Could not resolve placeholder 'jdbc.username' in string value "${jdbc.username}"
- iOS巅峰之UIScrollView滑动的左右上下位置控制
- module中build.gradle文件参数含义
- iOS5中UIViewController的新方法
- 用Maonry如何实现UIScrollView
- Required method destroyItem was not overridden
- iOS 设置项目的version和build号
- iOS 之版本号 Version / Build 分析与脚本自动化