二、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的上拉加载数据: 先看看效果图: 接着上拉,加载更多数据: 主要实现的效果是在我们上拉结束拖拽之后,开始加载数据,数据加载的过程中有滚动轮提示用户正在 ...
随机推荐
- string与stringbuilder的区别
1.分析string与stringbuilder的区别,我们先来看下面一段代码 首先我们使用string进行字符串的拼接 class Program { static void Main(string ...
- MVC的Model层中的一些便签
由于自己重新接触MVC,所以把Model层里的一些标签给记录下来,方便自己的使用. 这些是自己目前试用过的一些,在以后的工作中我会接着补充进去新的内容
- Hadoop 实现对Value倒序排序
数据源 A B C D Z 要实现的输出 Z D B C A 看字符顺序,其实什么也没有,只是按照后面的数字进行一次倒序排序,实现思路,1利用hadoop自带的排序功能,2.KV互换 实现代码 pub ...
- zookeeper集群的安装
顾名思义zookeeper就是动物园管理员,他是用来管hadoop(大象).Hive(蜜蜂).pig(小猪)的管理员, Apache Hbase和 Apache Solr 的分布式集群都用到了zook ...
- 杂记之web篇
问题1:通过POST方式提交给后台的数据出现了乱码,用部分浏览器测试却是好的. 解决办法: 在web.config文件中加上 <globalization responseEncoding=&q ...
- Swift - 34 - 闭包的基础语法
//: Playground - noun: a place where people can play import UIKit // 初始化一个整数数组 var arr = [1, 3, 5, 7 ...
- DWZ简介及其使用
来源:http://blog.csdn.net/t123012009065/article/details/8286826 DWZ简介: DWZ富客户端框架(jQuery RIA framewor ...
- oracle单行函数之类型转换
oracle数据类型转换:显示转换盒隐式转换 oracle自动完成转换
- 在linux下用tomcat部署java web项目的过程与注意事项(转)
一.安装JDK到http://www.oracle.com/technetwork/java/javase/downloads/index.html下载Java SE 6 Update 27根据操作系 ...
- 求最小生成树(Prim算法)(1075)
Description 求出给定无向带权图的最小生成树.图的定点为字符型,权值为不超过100的整形.在提示中已经给出了部分代码,你只需要完善Prim算法即可. Input 第一行为图的顶点个数n ...