-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) indexpath{
Self.maintitle=[[uilabel Alloc]init];
self.maintitle.numberoflines=0;
Self.maintitle.font=[uifont fontwithname:@ "Hiragino Sans GB" size:14];
Self.maintitle.text=cell_info.title;
Self.maintitle.textcolor=[uicolor Graycolor];
Cgsize titlesize=[self.maintitle.text boundingrectwithsize:cgsizemake ([UIScreen mainScreen].bounds.size.width-20, 0) Options:nsstringdrawinguseslinefragmentorigin Attributes:@{nsfontattributename:self.maintitle.font} context: Nil].size;
Self.rowheight=titlesize.height;
Self.maintitle.frame=cgrectmake (3, titlesize.width,titlesize.height);
[Cell.contentview AddSubview:self.mainTitle];
CGRect Cellframe=[cell frame];
Cellframe.origin=cgpointmake (0,0);
cellframe.size.height=self.maintitle.frame.size.height+5+self.imgone.frame.size.height+5;
[Cell Setframe:cellframe];
return cell;
}
-(CGFloat) TableView: (UITableView *) TableView Heightforrowatindexpath: (Nsindexpath *) indexpath{
if (indexpath.section==0) {
return 160;
}
else{
if (indexpath.row==0) {
UITableViewCell *cell=[self TableView:self.tableView Cellforrowatindexpath:indexpath];
return cell.frame.size.height;
// }
UITableViewCell *cell=[self TableView:self.tableView Cellforrowatindexpath:indexpath];
return cell.frame.size.height;
}
}
iOS dynamically sets the height of the cell