UITableView之(四):使用UITableViewCell
来源:互联网 发布:淘宝怎么分级别 编辑:程序博客网 时间:2024/06/05 09:10
创建使用tableViewCell有两种方式:
1、创建tableViewCell:常应用于代码创建
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *const cellId = @"cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleSubtitle) reuseIdentifier:cellId]; } // 设置cell的相关属性 return cell;}
2、注册tableViewCell:常应用于Xib/StoryBoard创建
在创建tableView的时候就进行cell的注册:
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:cellId]; // 代码创建 [self.tableView registerNib:[UINib nibWithNibName:@"创建xib设置的控件名" bundle:nil] forCellReuseIdentifier:cellId]; // xib创建使用注册创建tableViewCell,tableView的代理方法中,获取可重用的tableViewCell使用如下方法:
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId forIndexPath:indexPath];
0 0
- UITableView之(四):使用UITableViewCell
- UITableView之(三):UITableViewCell
- UITableView使用<1>之自定义UITableViewCell
- UITableView之(五):自定义UITableViewCell
- iphone开发之表格组件UITableView的使用(五)UITableView与UItableViewCell常见属性以及单元格重用
- iOS之UITableView的使用——自定义UITableViewCell
- iOS 之 UITableView 使用详解/性能优化/UITableViewCell/UITableViewController
- UITableView 系列之自定义 UITableViewCell
- UITableView 系列之自定义 UITableViewCell
- UI之UITableView和UITableViewCell
- UITableView与UITableViewCell的使用
- UITableView详解(UITableViewCell(四) 增加 删除 移动)
- UITableView&UITableViewCell
- UITableView技巧之去除UITableViewCell边框
- UITableView使用<2>UITableViewCell的介绍
- UITableView 系列五 :自定义UITableViewCell (实例)
- UITableView 系列五 :自定义UITableViewCell (实例)
- UITableView的使用(UITableViewCell\section页眉\section页脚复用、sectionHeaderView点击效果)
- 每天一条linux---find命令概述
- linux多线程学习(二)——线程的创建和退出
- mysql 触发器初探
- 用Java(递归算法)改变文件的最后访问时间!
- Java设计模式——责任链模式
- UITableView之(四):使用UITableViewCell
- 使用jcreator进行简单的用户登录网站
- entityframework Identity codefirst 使用MySql作为数据存储的笔记
- JavaScript 时间脚本收集
- linux的top命令参数详解
- 图片加载框架简单介绍<一> ImageLoader 的基本使用
- 502网关的问题
- [leetcode]——1.Two Sun
- mybatis自定义代码生成器(Generator)——自动生成model&dao代码