UITableView的常用代理方法

设置行高

- () tableView: (, *) tableView heightForRowAtIndexPath: (*) indexPath {

,,,

,,,,, 80,

}

//

- () numberOfSectionsInTableView: (, *) tableView

{

,//返回部分的数量。

,,,,, 3;

}

设置每个区有多少行共有多少行

- () tableView: (, *) tableView numberOfRowsInSection:也()部分

{

,,,,, 2,

}


设置区域的名称

- (, *) tableView: (, *) tableView titleForHeaderInSection:()节;

{

, return 

}


是否允许行移动

- () tableView: (, *) tableView canMoveRowAtIndexPath: (, *) indexPath

{

,,,,

,返回YES

}


响应点击事件

- () tableView: (, *) tableView didSelectRowAtIndexPath: (*) indexPath

{

, @ "

}


小按钮的响应事件

- () tableView: (, *) tableView accessoryButtonTappedForRowWithIndexPath: (, *) indexPath

{

,,,, (accessoryButton);,

,,,,

}


删除按钮的名字

- (*) tableView: (, *) tableView titleForDeleteConfirmationButtonForRowAtIndexPath: (, *) indexPath

{

,,,,,,

}

设置滑动,

- () tableView: (, *) tableView canEditRowAtIndexPath: (, *) indexPath

{

,//ruturn没有

,返回YES

}

- () tableView: (, *) tableView editingStyleForRowAtIndexPath: (, *) indexPath

{

, @ "

,, UITableViewCellEditingStyleDelete

//,,,,//

//,,,,返回UITableViewCellEditingStyleInsert;

}

设置细胞的样式

,,,,

//,,,,,,,,。selectionStyle=UITableViewCellSelectionStyleBlue;

,,,,,,,,

//,,,,。selectionStyle=UITableViewCellSelectionStyleGray;

,,,,,,,,

//,,,,,,,,。selectionStyle=UITableViewCellSelectionStyleNone;

,,,,,,,,

//,,,,,,,,。accessoryType=UITableViewCellAccessoryDisclosureIndicator;

,

//按钮accessoryType , UITableViewCellAccessoryDetailDisclosureButton



//简单的细胞与文本标签和可选的p_w_picpath视图(行为UITableViewCell iPhoneOS 2. x)

//左对齐标签和蓝色标签左对齐和右对齐文本(用于设置)

//右对齐标签剩下蓝色文本和左对齐标签(用于手机/联系人)

,,,, UITableViewCellStyleSubtitle


UITableView的常用代理方法