UILabel设置删除线(电商商品价格)
2016-05-03 15:30
447 查看
UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(20, 60, 100, 30)]; [self.view addSubview:lable]; lable.backgroundColor = [UIColor redColor]; lable.textAlignment = NSTextAlignmentCenter; NSString *oldPrice = @"¥ 999999"; NSUInteger length = [oldPrice length]; NSMutableAttributedString *attri = [[NSMutableAttributedString alloc] initWithString:oldPrice]; [attri addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle) range:NSMakeRange(0, length)]; [attri addAttribute:NSStrikethroughColorAttributeName value:[UIColor yellowColor] range:NSMakeRange(0, length)]; [lable setAttributedText:attri];
相关文章推荐
- leetcode51/52-N-Queens I/II(n皇后问题)
- easyui treegrid的拖拽效果实现
- NGUI翻页
- UIPageViewControllerDataSource
- rails 多态关联 (:polymorphic => true)
- Xamarin Studio –Project not built in active configuration
- POJ 3581 Sequence(后缀数组)
- Android通过反射获取build.prop中key对应的value
- UIActivityIndicatorView
- 2016.05.03,英语,《Vocabulary Builder》Unit 21
- IOS开发中如何给UIImageView添加点击事件
- android color values
- Dataquest用户流失预测
- Android——requestWindowFeature()的应用
- UIPageViewController
- 使用map的value值排序
- 设置searchDisplayController的searchResultsTableView的UITableViewStyle为grouped
- JSP for query
- [leetcode] 307. Range Sum Query - Mutable 解题报告
- Request.InputStream 接收Post Data