#pragma mark--TableView delegate
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *str =@"cellid";
UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:str];
if (!cell) {
cell =[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:str];
}
CGRect cellframe =cell.frame;
if (indexPath.row ==0) {
cell.textLabel.text =self.dataArr[0];
cell.textLabel.numberOfLines =0;
// CGRect rect = [cell.textLabel.text boundingRectWithSize:CGSizeMake(200, 1000) options:NSStringDrawingTruncatesLastVisibleLine attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]} context:nil];
cell.textLabel.lineBreakMode = NSLineBreakByTruncatingTail;
CGSize maximumLabelSize = CGSizeMake(375, 300);
CGSize rect = [cell.textLabel sizeThatFits:maximumLabelSize];
cellframe.size.height =rect.height +10;
}
else if(indexPath.row ==1)
{
cell.textLabel.text =self.dataArr[1];
// CGRect rect = [cell.textLabel.text boundingRectWithSize:CGSizeMake(200, 200) options:NSStringDrawingTruncatesLastVisibleLine attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16]} context:nil];
cell.textLabel.numberOfLines =0;
cell.textLabel.lineBreakMode =NSLineBreakByTruncatingTail;
CGSize maximumLabelSize =CGSizeMake(375, 350);
CGSize rect =[cell.textLabel sizeThatFits:maximumLabelSize];
cellframe.size.height =rect.height +25;
}
cell.frame =cellframe;
return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [selftableView:tableView cellForRowAtIndexPath:indexPath];
return cell.frame.size.height;
}