//contentView

//行内容
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//从重用队列中取出闲置单元格
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
//判断cell是否为nil
if (cell == nil) {
//创建单元格的时候,要确保重用标示符跟获取闲置单元格的时候一致
cell = [[UITableViewCell alloc] initWithStyle:indexPath.row % reuseIdentifier:identifier];
//添加右边的图标
UIImageView *iconView = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetWidth(tableView.frame) - - , , , )];
[cell.contentView addSubview:iconView];
iconView.tag = ; //添加左边的标题Label
UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(, , CGRectGetWidth(cell.frame) - , )];
[cell.contentView addSubview:titleLabel];
titleLabel.tag = ;
} UIImageView *iconView = [cell.contentView viewWithTag:];
UILabel *titleLabel = [cell.contentView viewWithTag:]; //设置内容
NSString *iconName = [NSString stringWithFormat:@"icon%ld.jpg",indexPath.row % ];
iconView.image = [UIImage imageNamed:iconName]; titleLabel.text = self.datas[indexPath.row]; return cell; }

最新文章

  1. 1260: [CQOI2007]涂色paint
  2. php/js获取客户端mac地址的实现代码
  3. FAQ: Machine Learning: What and How
  4. Android实现SharePreferences和AutoCompletedTextView
  5. java 开发环境
  6. java vm args
  7. CF 208E. Blood Cousins [dsu on tree 倍增]
  8. EtherChannel(PAgP、LACP)基本配置--端口聚合--(转)
  9. Linux环境——MySQL安装及配置(5.7版本)
  10. JavaScript实现input输入框限制输入值的功能
  11. List遍历三种方法:1.for 2.增强性for 3.迭代器
  12. Head First Servlets & JSP 学习笔记 第二章 —— Web应用体系结构
  13. ovs flow 原理及实验
  14. 第1阶段冲刺成果—简单运算game(APP)
  15. Linux 下用 smartd 监测硬盘状况
  16. Openerp 7.0消息推送
  17. Spring Tool Suite 配置和使用
  18. PHP Ajax跨域解决
  19. nvidia tk1使用记录--基本环境搭建
  20. pandas数据结构和介绍第一天

热门文章

  1. cocos代码研究(19)Widget子类ImageView学习笔记
  2. nginx自动生成缩略图
  3. 前端面试题之 sum(2)(3) (链式调用,toString,柯里化,数组操作)
  4. ESXi上的固态硬盘识别为非SSD
  5. rm删除某个文件之外的文件
  6. POJ 1185 炮兵阵地(状压DP)题解
  7. 嵌入式Linux应用程序开发环境搭建记录
  8. Python学习札记(三十一) 面向对象编程 Object Oriented Program 2
  9. C# .NET 开发心得
  10. 【源码学习之spark core 1.6.1 standalone模式下的作业提交】