IOS - 购买类型视图
2015-07-10 18:30
836 查看
购买类型视图定制
代码
效果
代码
// 支付页面格式 - (UIView*) CellForRowAtRow:(NSInteger) row { UIView* itemView = [UIView viewWithFrame: CGRectMake(0, 0, viewWidth() - 20, 45) andBkColor: [UIColor clearColor]]; NIDASSERT(row < _alipayInfo.count); if (row < _alipayInfo.count) { // 会员包年包月 UILabel* titleLabel = [UILabel labelWithFrame: CGRectMake(10, 15, 100, 15) fontSize: 14 fontColor: RGBCOLOR_HEX(0x666666) text: _alipayInfo[row][@"desc"]]; [itemView addSubview: titleLabel]; // 价钱 CYAttributedLabel* pricelabel = [[CYAttributedLabel alloc] initWithFrame: CGRectMake(0, 12, 125, 20)]; pricelabel.verticalTextAlignment = NIVerticalTextAlignmentTop; pricelabel.text = [NSString stringWithFormat: @"%@元", _alipayInfo[row][@"price"]]; pricelabel.font = [UIFont boldSystemFontOfSize: 14]; pricelabel.textColor = RGBCOLOR_HEX(0xff6000); [pricelabel setFont: [UIFont boldSystemFontOfSize: 11] range: [pricelabel.text rangeOfString: @"元"]]; pricelabel.textAlignment = NSTextAlignmentRight; [itemView addSubview: pricelabel]; // 和原价的比较 CYAttributedLabel* originPriceLabel = [[CYAttributedLabel alloc] initWithFrame: CGRectMake(145, 16, 110, 18)]; originPriceLabel.font = [UIFont systemFontOfSize: 11]; originPriceLabel.verticalTextAlignment = NIVerticalTextAlignmentTop; originPriceLabel.cssHandler = [CYResource getCssHandler]; originPriceLabel.text = _alipayInfo[row][@"old_price"]; originPriceLabel.textColor = RGBCOLOR_HEX(0x666666); [itemView addSubview: originPriceLabel]; NSArray *array = [originPriceLabel.text componentsSeparatedByString:@" "]; // 划线 UIView *lineView = [[UIView alloc] init]; lineView.backgroundColor = originPriceLabel.textColor; [itemView addSubview:lineView]; UILabel *subLabel = [UILabel labelWithFrame:CGRectZero fontSize:14 fontColor:[UIColor blackColor] text:array[0]]; [subLabel sizeToFit]; lineView.frame = CGRectMake(originPriceLabel.left, originPriceLabel.top + 7, subLabel.width - 10, 1); // 选中的按钮 UIButton* button = [UIButton buttonWithBackgroundImage: @"choose_icon_normal.png" selectedBackgroundImage: @"choose_icon_selected.png" frame: CGRectMake(viewWidth() - 50, 14, 20, 20) target: nil selector: nil]; [itemView addSubview: button]; } return itemView; }
效果
相关文章推荐
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 峰回路转,Firefox 浏览器即将重返 iOS 平台
- 动态生成SQL Server视图作业
- 不可修补的 iOS 漏洞可能导致 iPhone 4s 到 iPhone X 永久越狱
- iOS 12.4 系统遭黑客破解,漏洞危及数百万用户
- 每日安全资讯:NSO,一家专业入侵 iPhone 的神秘公司
- [转][源代码]Comex公布JailbreakMe 3.0源代码
- SQL server 视图(view)介绍
- dba_indexes视图的性能分析
- SQL SERVER先判断视图是否存在然后再创建视图的语句
- sql server判断数据库、表、列、视图是否存在
- ASP.NET Web API教程 创建Admin视图详细介绍
- SQLite教程(三):数据表和视图简介
- oracle中的视图详解
- js判断客户端是iOS还是Android等移动终端的方法
- IOS开发环境windows化攻略
- .net平台推送ios消息的实现方法
- 简介AngularJS的视图功能应用
- ASP.NET MVC中的视图生成实例分析