使用方法网上很多不赘诉,只说注意事项,不做会崩溃
1、 storyboard中动态Cell所在的section中必须预留一个Cell,可以是任意一个Cell;
2、 - (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath;方法必须重写;
- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath{
if(1 == indexPath.section){
return [super tableView:tableView indentationLevelForRowAtIndexPath: [NSIndexPath indexPathForRow:0 inSection:1]];
}
return [super tableView:tableView indentationLevelForRowAtIndexPath:indexPath];
}
3、 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath;方法必须重写;
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if(1 == indexPath.section){
return 100.0;
}
return [super tableView:tableView heightForRowAtIndexPath:indexPath];
}
日常开发使用心得整理,如有纰漏,欢迎指正!!!