iphone/ipad开发之UITableView的方法

来源:互联网 发布:软件编辑器手机版 编辑:程序博客网 时间:2024/05/21 06:54

1.-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;

//传入一个tableview

//返回tableview的区数

2. -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;

//传入一个tableview和该tableview的特定分区section

 //返回该分区中行数

3. -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;

 //传入一个tableview与该tableview的某行索引

//从索引路径获取分区和行,用来确定使用哪个值

 4. -(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section;

//传入一个tableview和该tableview的特定分区section

//返回每个分区的标题值,可以自定义,这里得到分区名

5.- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView;

//传入一个tableview

//返回该tableview的分区索引

6. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

//点击一个cell后触发的事件


7. -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 

 //设置行高

8.-(NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath;


//此方法将缩进级别设置为行号,返回缩进数字
 9.-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath; 

 //点击一个cell前触发的事件

10.-(UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath {return UITableViewCellAccessoryDisclosureIndicator;} 

//每一行都显示一个展示按钮
 
原创粉丝点击