这里简单介绍一下上篇使用但没有着重突出的一些方法大家可以自己下去实现并观测效果
//设置标题头的宽度
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 40;
}
//设置标题尾的宽度
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 44;
}
//设置标题头的名称- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return [NSString stringWithFormat:@"这是第%ld组的头",section];
}
//设置标题脚的名称
-(NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
{
return [NSString stringWithFormat:@"这是第%ld组的脚",section];
//设置cell 的宽度
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 44;
}
//下面两个方法可以设置头视图尾视图,我们可以在view上做任何事情,具体就看大家想怎么办了
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
}
-(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
}
//允许编辑
-(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{
return YES;
}
//允许移动
-(BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
//一定要实现这个移动回调
-(void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath{
}//设置缩(进风格为默认)
-(NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSUInteger row = [indexPath row];
return row;
}