二、UITableView和它的亲戚们
. 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和它的亲戚们的更多相关文章
- UITableView使用指南
本文转载至 http://blog.csdn.net/yu0089/article/details/8227402 一.概述 UITableView是iOS开发比不可少也是最重要的一个控件类.可以说任 ...
- IOS开发之表视图(UITableView)
IOS开发之表视图(UITableView)的基本介绍(一) (一):UITableView的基本概念 1.在IOS开发中,表视图的应用十分广泛和普及.因此掌握表视图的用法显得非常重要.一般情况下对于 ...
- iOS-UITableView的优化(纯手打原创)
TableView的优化 一:什么是TableView的优化以及为什么要优化 1)CPU(中央处理器)和GPU(图形处理器) CPU主要从事逻辑计算的一些工作 GPU主要从事图形处理方面的工作 2 ...
- ios基础篇(十四)——UITableView(二)属性及基本用法
上一篇说了UITableView的重用机制,让我们对UITableView有了简单了解,下面说说UITableView的属性及常见方法. 一.属性 1.frame:设置控件的尺寸和大小 2.backg ...
- iOS开发UI篇—使用UItableview完成一个简单的QQ好友列表(二)
一.实现效果 二.实现代码 1.数据模型部分 YYQQGroupModel.h文件 // // YYQQGroupModel.h // 02-QQ好友列表(基本数据的加载) / ...
- iOS开发——开发必备OC篇&UITableView设置界面完整封装(二)
UITableView设置界面完整封装(二) 简单MVC实现UITableView设置界面之Cell右边类型设置 首先来看看第一种方法证明使用,结合两种方法之后根据个人的爱好去选择就可以了, 一:使用 ...
- UIPasteboard粘贴板:UITableView复制粘贴功能(二)
这篇咱写写一写在UITableView上实用剪贴板的两种方法: 一:在自定义cell里面使用 其实,在cell的使用跟在label里面的用法基本一样 1.放方法: - (BOOL)canBecomeF ...
- UITableView(二)
#import "ViewController.h" @interface ViewController () @end @implementation ViewControlle ...
- ios基础篇(二十八)—— UITableView的上拉加载
本文主要展示一个demo实现UITableView的上拉加载数据: 先看看效果图: 接着上拉,加载更多数据: 主要实现的效果是在我们上拉结束拖拽之后,开始加载数据,数据加载的过程中有滚动轮提示用户正在 ...
随机推荐
- Java分页类 Page
import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.Iterator; ...
- activiti_SpringEnvironment
package main; import org.activiti.engine.ProcessEngine; import org.activiti.engine.ProcessEngines; i ...
- PL/SQL客户端安装配置说明
一.电脑安装了多个Oracle客户端时,需要设定pl/sql 中的home 二.配置环境变量: (打开环境变量配置界面操作:我的电脑---属性---高级---环境变量,在系统变量部分新建或编辑即可.w ...
- osg for android (一) 简单几何物体的加载与显示
1. 首先需要一个OSG for android的环境. (1).NDK 现在Eclipse 对NDK已经相当友好了,已经不需要另外cygwin的参与,具体可以参考 Android NDK开发篇(一) ...
- MYSQL id 自动加1
个人心得 建立好表以后再进行修改总是容易出错 建议用sql语句进行创建表,定义相应的属性 CREATE TABLE USER( Id INTEGER PRIMARY KEY AUTO_INCREMEN ...
- sprintf mfc
sprintf(d,"char is %d",wparam);wparam以%d形式存入d中 并不是输出到屏幕上!
- Java Tomcat 中调用.net DLL的方法
近日一个java的项目,客户要求项目中必须使用其提供的加密机制,扔给了两个.net写的DLL.网络上搜了一圈也没找到啥东西,甚至看到人扬言此事绝无可能.郁闷当中考虑了一个思路.用C#做一个Com,调用 ...
- RazorEngine 学习笔记
refer : https://github.com/Antaris/RazorEngine 微软的模板编辑器. Install-Package RazorEngine using RazorEngi ...
- Javascript Promise 学习 (中)
时隔多日,对promise有了多一点点的了解. 最近用angularjs 做开发,所以研究了一下它的 $q 功能不算很强大,算是简化版的 Q.js 参考了一下源码,不过我的等级还差很多... 作为学习 ...
- hdu 2992 Hotel booking
http://acm.hdu.edu.cn/showproblem.php?pid=2992 #include <cstdio> #include <cstring> #inc ...