ios UILabel 添加删除线或者下滑线
2016-06-01 15:13
1456 查看
//添加删除线 UILabel *strLabel = [[UILabel alloc] initWithFrame:(CGRectMake(10, 10, 120, 30))]; NSString *textStr = [NSString stringWithFormat:@"从现在开始"]; NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]}; NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc] initWithString:textStr attributes:attribtDic]; strLabel.attributedText = attribtStr; [self.view addSubview:strLabel];
//添加下划线 UILabel *strLabel = [[UILabel alloc] initWithFrame:(CGRectMake(10, 10, 120, 30))]; NSString *textStr = [NSString stringWithFormat:@"坚持就是信仰"]; NSDictionary *attribtDiction = @{NSUnderlineStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]}; NSMutableAttributedString *attribtString = [[NSMutableAttributedString alloc] initWithString:textStr attributes:attribtDiction]; strLabel.attributedText = attribtString; [self.view addSubview:strLabel];
相关文章推荐
- iOS开发UI篇—使用UItableview完成一个简单的QQ好友列表(一)
- iOS开发-UINavigationBar透明设置
- Unique Binary Search Trees
- UITableView优化——UITableViewCell高度的优化
- UITableView优化——UITableViewCell高度的优化
- UIView加任意边框(Masonry)
- 关于(UITableViewcell)contentView高度的问题
- 为什么设置了view的Opaque性能会提高(GPU)
- 二叉树的层序遍历
- Solr --- Query
- Unique Binary Search Trees II
- iOS UIBezierPath图形绘制
- SUID和SGID位简介
- Geometry cannot have Z values.
- org.hibernate.QueryException:Expected positional parameter count: 1
- UIScrollView的PageEnable可以实现slider
- Import Project...出现 Building 'xxxx' Gradle project info会卡半天,完美解决
- 斐波那契数列-Fibonacci Sequence
- LTE UE不活动定时器的工作机制
- 监听UITextField内容改变简单方法