UITableView 委托方法总结
UITableView应用(一)UITableViewDelegate方法总结
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
// indexPath.section,根据分组进行更精确的配置
return 90.0;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
return [_arrayType objectAtIndex:section];
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return 30.0;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
// 自定义的Header
ViewForCellHeader *headerView=[[[ViewForCellHeader alloc] init] autorelease];
headerView.strSectionName=[_arrayType objectAtIndex:section];
return [headerView view];
}
注意:2与4是互斥的。
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section{
return [_arrayType objectAtIndex:section];
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
// indexPath.section,根据分组进行更精确的配置
return 30.0;
}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
// 自定义的Footer
ViewForCellHeader *headerView=[[[ViewForCellHeader alloc] init] autorelease];
headerView.strSectionName=[_arrayType objectAtIndex:section];
return [headerView view];
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{
return [_arrayType objectAtIndex:section];
}
UITableView应用(二)UITableViewDataSource 方法总结
NSMutableArray *_arrayType;// 分组
1.返回分组数
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return [_arrayType count];
}
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
NSString *curType=[_arrayType objectAtIndex:section];
return [[_dictData objectForKey:curType] count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath
*)indexPath{
NSUInteger section = [indexPath section];
NSUInteger row = [indexPath row];
NSString *key=[_arrayType objectAtIndex:section];
NSMutableArray *arrValues=[_dictData objectForKey:key];
static NSString *CellIdentifier = @"WTVChannelCell";
// 自定义cell
WTVChannelCell *cell = (WTVChannelCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil){
cell = [[[WTVChannelCell alloc] initWithStyle:UITableViewCellSelectionStyleGray
reuseIdentifier:CellIdentifier]
autorelease];
NSArray *array =
[[NSBundle mainBundle] loadNibNamed:@"WTVChannelCell" owner:nil
options:nil];
cell =
[array objectAtIndex:0];
}
cell.dictChannelData=[arrValues objectAtIndex:row];
[cell refreshCellData];
return cell;
}
UITableView 委托方法总结的更多相关文章
- (转载)IOS中UIScrollView的属性和委托方法
http://www.jizhishusheng.com/?p=453 ---- 以下内容来自 UIScrollView 类负责所有基于 UIKit 的滚动操作一.创建 1. CGRect bou ...
- UITableView表格视图、UITableView代理方法及应用
一.基本知识点 UITableView表格视图,是一个可以滚动的界面(理解为垂直滚动的UIScrollView),可展示多行数据,没有行数的限制,只能有一列. 使用UITableView: 1.展示信 ...
- 事件、委托、委托方法的总结(使用EventHandler<>)
在C#中,定义事件.委托.委托方法可以使用类库内的EventHandler泛型委托来定义事件.并根据该泛型委托定义实现方法: 同样您也可以自定义委托 来定义事件以及 根据自定义的委托来定义实现事件的方 ...
- .NET自带泛型委托方法Func、Action和Predicate
Func.Action和Predicate是.NET自带的3个泛型委托方法,三个方法的区别其实并不大,要强行给混着用也是可以的,但是我们是有追求的人,把道理讲清楚总是好的. 一.Func是有返回值的方 ...
- 匿名委托(方法) 以 ThreadStart 为例
Hello Tec. 匿名委托(方法) 以 ThreadStart 为例 REF:http://baike.baidu.com/view/2761370.htm?fr=aladdin 不使用匿 ...
- IOS UITableview代理方法总结
tableview的datasource代理 @required的两个数据源方法 1.返回每个 session 中 cell 的个数 - (NSInteger)tableView:(UITableVi ...
- 两种局部刷新UITableView的方法的使用条件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ //1.取消选 ...
- 【转】iOS UITableView的方法解析
原文网址:http://www.cnblogs.com/wfwenchao/articles/3718742.html - (void)viewDidLoad { [super viewDidLoad ...
- jQuery事件委托方法 bind live delegate on
1.bind jquery 1.3之前 定义和用法:主要用于给选择到的元素上绑定特定事件类型的监听函数 语法: bind(type,[data],function(e)); 特点: a.适合页 ...
随机推荐
- js1常用的东西
1 .ready 与resize方法.$(inject).ready(function() { var windowWidth = $(document.body).outerWidth(true); ...
- linux中的数值运算
一.declare 作用:声明变量类型,bash默认变量为字符串类型的,并且字符串在拼接时直接拼接,不需要加号 使用方法: 二.数值运算 加法运算 a= b= c=$(($a+$b)) echo $c
- jQuery基础之(五)jQuery自定义添加"$"与解决"$"的冲突
1.自定义添加$ 从上面四篇文章我们看到jQuery的强大,但无论如何,jQuery都不可能满足所有用户的需求,而且有一些需求十分小众,也不适合放到整个jQuery框架中,正是因为这一点,jQuery ...
- hdu1217 floyd
floyd一遍即可.如果floyd后值有变大就是 #include<map> #include<string> #include<stdio.h> #include ...
- java2集合框架的一些个人分析和理解
Java2中的集合框架是广为人知的,本文打算从几个方面来说说自己对这个框架的理解. 下图是java.util.Collection的类图(基本完整,有些接口如集合类均实现的Cloneable.Seri ...
- 洛谷P2726 阶乘 Factorials
题目背景 N的阶乘写作N!,表示小于等于N的所有正整数的乘积. 题目描述 阶乘会变大得很快,如13!就必须用32位整数类型来存储,到了70!即使用浮点数也存不下了. 你的任务是找到阶乘最前面的非零位. ...
- POJ 3258 River Hopscotch
River Hopscotch Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 11031 Accepted: 4737 ...
- HDU #5507 GT and Strings
这是AC自动机系列的第一篇 传送门 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Othe ...
- python获取命令行参数的方法
想用python处理一下文件,发现有argv这个用法,搜来学习一下. 如果想对python脚步传参数,那么就需要命令行参数的支持了,这样可以省的每次去改脚步了. 用法是:python xx.py ...
- linux 的jdk安装
1.1 解压上传的安装包 1.2 创建安装目录 1.3 将解压后的目录移动到安装目录 1.4 配置环境变量 修改www.qixoo.qixoo.com/etc/profile文件 ...