UITableView
2015-10-22 20:00
393 查看
创建Cell的3种方式:
1.storyboard创建cell 在storyboard中创建cell ,设置cell的id,创建UITableViewCell的子类,写cell创建的类方法 用dew方法,创建Model属性,改写Model的setter方法,将cell的属性通过model赋值。
2.xib创建:1、提供类方法创建cell,先从队列中获取,如果失败,使用alloc init创建2.重写init方法,创建init方法,子控件的一次性属性 3.添加frame模型,重写setter方法,重写layoutSubviews方法,设置frame赋值4.在frame模型设定数据模型,添加cell的子控件frame,设置cell的高度,实现模型重载
3.纯代码创建:创建Cell文件,写cell的创建方法,判断cell为空时,使用alloc init方法创建
4.tableView:写数据源方法
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 设置cell高度
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath cell的点击方法 用indexPath确认点击的是哪个cell
头的高度 尾的高度
1.storyboard创建cell 在storyboard中创建cell ,设置cell的id,创建UITableViewCell的子类,写cell创建的类方法 用dew方法,创建Model属性,改写Model的setter方法,将cell的属性通过model赋值。
2.xib创建:1、提供类方法创建cell,先从队列中获取,如果失败,使用alloc init创建2.重写init方法,创建init方法,子控件的一次性属性 3.添加frame模型,重写setter方法,重写layoutSubviews方法,设置frame赋值4.在frame模型设定数据模型,添加cell的子控件frame,设置cell的高度,实现模型重载
3.纯代码创建:创建Cell文件,写cell的创建方法,判断cell为空时,使用alloc init方法创建
4.tableView:写数据源方法
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 设置cell高度
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath cell的点击方法 用indexPath确认点击的是哪个cell
头的高度 尾的高度
相关文章推荐
- apue第三版 在信号处理程序中调用不可再入函数 的例子遇到的问题
- iOS开发7-KVO(Key-Value Observer)键值观察
- iOS开发拓展篇—UIDynamic(捕捉行为)
- [Leetcode]Unique Paths II
- iOS开发拓展篇—UIDynamic(重力行为+碰撞检测)
- Recruit Coupon Purchase Winner's Interview: 2nd place, Halla Yang
- iOS开发拓展篇—UIDynamic(简单介绍)
- iOS开发UI篇—无限轮播(功能完善)
- iOS开发UI篇—无限轮播(循环展示)
- 【FAQ】xcodebuild in command line,报错:No architectures to compile for xxx,怎么办?
- iOS开发UI篇—无限轮播(新闻数据展示)
- iOS开发UI篇—无限轮播(循环利用)
- burp suite
- hdu 5504 GT and sequence(dp)
- POJ1019 Number Sequence
- zoj 3911 Prime Query(线段树)
- duilib 自定义控件TeamList 继承与CListUI
- duilib 自定义控件1 CTileLayoutUI
- 解决VirtualBox分辨率太小及VBoxGuestAdditions_4.3.12.iso下载地址
- valueForKeyPath 的使用(真心不知道啊)