. UITableView

参考:
https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITableView_Class/Reference/Reference.html ) 初始化 UITableView对象
– initWithFrame:style: // 代码生成方式,如果你在nib里加的tableview不需要使用这个方法
)配置TableView
– dequeueReusableCellWithIdentifier: // 必须要实现的方法,与TableView同生同死
style property // 有两种 UITableViewStylePlain, UITableViewStyleGrouped,经常用
– numberOfRowsInSection: //一个section有多少行,经常用
– numberOfSections //一个TableView有多少个section,经常用
rowHeight property // 行高,和tableView:heightForRowAtIndexPath:有性能上的区别
separatorStyle property // cell之间的分割线?待确认
separatorColor property // 同上
backgroundView property // tableview的背景view, 这个背景view在所有cell, header views, footer views之后
tableHeaderView property // tableview上方的一个headerView, 和delete里的section header不是一个概念
tableFooterView property // tableview下方的一个footerview
sectionHeaderHeight property // section Header的高度,
sectionFooterHeight property // sectjion Footer的高度
sectionIndexMinimumDisplayRowCount property // 功能待确认? 参考例子: TheElements
) 访问Cells和Sections
– cellForRowAtIndexPath: //根据IndexPath返回cell
– indexPathForCell: //根据cell返回它的indexPath,和上面的方法互补
– indexPathForRowAtPoint://根据一个几何点返回indexPath,如果超过边界返回nil
– indexPathsForRowsInRect: //根据一个几何的矩形返回矩形所覆盖的行,返回是一个indexPath数组
– visibleCells // 不清楚怎么用,待确认
– indexPathsForVisibleRows //同上
) 滚动TableView
– scrollToRowAtIndexPath:atScrollPosition:animated: // 滚动到指定位置
– scrollToNearestSelectedRowAtScrollPosition:animated: // 同上
) 管理sections
– indexPathForSelectedRow //返回选定行的indexPath,单行
– indexPathsForSelectedRows //返回选定行的indexPath数组,多行
– selectRowAtIndexPath:animated:scrollPosition: //根据indexPath选择一行
– deselectRowAtIndexPath:animated: //反选一行,有何用?
allowsSelection property //是否允许用户选取一行
allowsMultipleSelection property // 是否选取多行,缺省为NO. 可以试试YES后的效果,哈哈
allowsSelectionDuringEditing property // 编辑模式时是否可选取一行
allowsMultipleSelectionDuringEditing property // 编辑模式时可否选取多行
) 插入、删除、移动行和sections
– beginUpdates // 和endUpdates一起用,让插入、删除、选择操作同时动画,没用过
– endUpdates //
– insertRowsAtIndexPaths:withRowAnimation: //根据indexPath数组插入行
– deleteRowsAtIndexPaths:withRowAnimation: //根据indexPath数组删除行
– moveRowAtIndexPath:toIndexPath: //移动一行到另一行
– insertSections:withRowAnimation: //插入sections
– deleteSections:withRowAnimation: //删除sections
– moveSection:toSection: //移动section
) 管理和编辑cell
editing property // YES进入编辑模式,tableview cell会出现插入、删除、重排序的控件
– setEditing:animated: //设置进入退出编辑模式
) 重新加载TableView
– reloadData // 重建整个表,包括cells、header、footer,indexs
– reloadRowsAtIndexPaths:withRowAnimation: // 改进,不用reload整个表
– reloadSections:withRowAnimation: // 同上
– reloadSectionIndexTitles // 同上
) 访问TableView的画图区
– rectForSection: // 返回指定section的矩形
– rectForRowAtIndexPath: //返回indexPath指定行的矩形
– rectForFooterInSection: // 返回section的footer矩形
– rectForHeaderInSection: // 返回section的header矩形
) Registering Nib Objects for Cell Reuse
– registerNib:forCellReuseIdentifier: //
) 管理委托和数据源 (重要)
dataSource property // 通常会这么用: myTableView.delegate = self; self 为viewController
delegate property // 通常会这么用: myTableView.dataSource = self; self 为viewController

二、UITableView和它的亲戚们的更多相关文章

  1. UITableView使用指南

    本文转载至 http://blog.csdn.net/yu0089/article/details/8227402 一.概述 UITableView是iOS开发比不可少也是最重要的一个控件类.可以说任 ...

  2. IOS开发之表视图(UITableView)

    IOS开发之表视图(UITableView)的基本介绍(一) (一):UITableView的基本概念 1.在IOS开发中,表视图的应用十分广泛和普及.因此掌握表视图的用法显得非常重要.一般情况下对于 ...

  3. iOS-UITableView的优化(纯手打原创)

    TableView的优化 一:什么是TableView的优化以及为什么要优化 1)CPU(中央处理器)和GPU(图形处理器)   CPU主要从事逻辑计算的一些工作 GPU主要从事图形处理方面的工作 2 ...

  4. ios基础篇(十四)——UITableView(二)属性及基本用法

    上一篇说了UITableView的重用机制,让我们对UITableView有了简单了解,下面说说UITableView的属性及常见方法. 一.属性 1.frame:设置控件的尺寸和大小 2.backg ...

  5. iOS开发UI篇—使用UItableview完成一个简单的QQ好友列表(二)

    一.实现效果             二.实现代码 1.数据模型部分 YYQQGroupModel.h文件 // // YYQQGroupModel.h // 02-QQ好友列表(基本数据的加载) / ...

  6. iOS开发——开发必备OC篇&UITableView设置界面完整封装(二)

    UITableView设置界面完整封装(二) 简单MVC实现UITableView设置界面之Cell右边类型设置 首先来看看第一种方法证明使用,结合两种方法之后根据个人的爱好去选择就可以了, 一:使用 ...

  7. UIPasteboard粘贴板:UITableView复制粘贴功能(二)

    这篇咱写写一写在UITableView上实用剪贴板的两种方法: 一:在自定义cell里面使用 其实,在cell的使用跟在label里面的用法基本一样 1.放方法: - (BOOL)canBecomeF ...

  8. UITableView(二)

    #import "ViewController.h" @interface ViewController () @end @implementation ViewControlle ...

  9. ios基础篇(二十八)—— UITableView的上拉加载

    本文主要展示一个demo实现UITableView的上拉加载数据: 先看看效果图: 接着上拉,加载更多数据: 主要实现的效果是在我们上拉结束拖拽之后,开始加载数据,数据加载的过程中有滚动轮提示用户正在 ...

随机推荐

  1. HUD 1251 难题统计

    /* 这题倒是没啥难度 字典树可搞 但是吧 空间是个问题 开始写成这样 struct node { int next[27],sum[27]; bool over; }t[maxn]; 死活过不了 开 ...

  2. 05-XML遍历递归显示到TreeView上(XDocument类)

    1.XML文件(x1.xml): <?xml version="1.0" encoding="utf-8" ?> <itcast> &l ...

  3. Xml序列化自引用/循环引用问题1

    1.定义类 public class Student { public int ID { get; set; } public string Name { get; set; } //[XmlIgno ...

  4. effective C#之 - 使用属性代替成员变量

    使用属性代替公共成员变量,一个很明显的好处是,很容易在一个地方对成员变量进行控制,例如: class Customer { private string name; public string Nam ...

  5. C#将图片字节流转为Base64直接放入html的img标签src属性中

    1,图片要转为byte[], 2,注意加上“data:image/jpeg;base64,”,这里jpeg可以换成其他. string html = "<img src='data:i ...

  6. 将图片转换为Base64

    string Imagefilename   硬盘路径 protected string ImgToBase64String(string Imagefilename) { try { Bitmap ...

  7. 在MyEclipse中设置Source folders和output folder

    在一个项目中可能会有多个资源文件,它们共同编译输出到输出文件.那么除了默认的src以外,如何把其他文件设置成资源文件(Source folders)呢?

  8. 高放的c++学习笔记之关联容器

    标准库提供8个关联容器 按关键字有序保存有(红黑树实现) set map multset 关键字可重复出现的set multimap  关键字可重复出现的map 无序保存 哈希实现 unorderre ...

  9. C/C++中的++a和a++

    代码: #include <iostream> #include <cstdio> using namespace std; int main(){ ; (++a)+=a; / ...

  10. C++中类成员使用前需要初始化的重要性

    今天写程序的时候,创建了一个结构体: struct BufferObj { char* buf; int bufLen; SOCKADDR_STORAGE addr; int addrLen; str ...