//字体大小设置
cell.resultTableContent.font = [UIFont systemFontOfSize:13];
//最小字体设置。如果当内容比较多时。没有设置最小字体的话。那么这时字体就会变小。如果设置了最小字体和上面的大小 是一样的。那么字体就比较统一了。
cell.resultTableContent.minimumFontSize = 13.0;
//设 置UItableViewCell里面 uilabel字体大小 自动适应。可以在这个方法里设置
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"222");
SchoolInHandAppDelegate *app = [[UIApplication sharedApplication]delegate];
ReadNoticeInterface *readNotice = [[ReadNoticeInterface alloc]init];
//计算出标题与内容所所占的行数。用于返回tableViewcell高度
UILabel *titleLabel = [[UILabel alloc]init];
titleLabel.frame = CGRectMake(20, 55, 280, 30);
titleLabel.font = [UIFont systemFontOfSize:17];
int titleCellCount;
int titleCellCountHight;
UILabel *label = [[UILabel alloc]init];
label.frame = CGRectMake(20, 80, 280, 30);
label.font = [UIFont systemFontOfSize:14];
int tableViewCellCount;
int tableViewCellCountHight;
if(indexPath.row< app.moudle.specificNoticeCount)
{
[readNotice switchTableCellContent:app.moudle.READFORNOTICETYPE :indexPath.row];
//计算出通知内容占几行
label.text = app.moudle.specificnoticeContent;
CGSize labelSizeForheight = [label.text sizeWithFont:label.font];
CGSize labelSizeForLines = [label.text sizeWithFont:label.font constrainedToSize:CGSizeMake(280, MAXFLOAT) lineBreakMode:UILineBreakModeWordWrap];
label.numberOfLines =ceil(labelSizeForLines.height/labelSizeForheight.height);
tableViewCellCount = label.numberOfLines;
tableViewCellCountHight=labelSizeForLines.height;
//计算出标题通知占几行
titleLabel.text = app.moudle.specificnoticeTitle;
//titleLabel.text = @"sadfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasdfasfasdfasdfsdfdfasdfasdfasdf";
CGSize labelSizeForheightT = [titleLabel.text sizeWithFont:titleLabel.font];
CGSize labelSizeForLinesT = [titleLabel.text sizeWithFont:titleLabel.font constrainedToSize:CGSizeMake(280, MAXFLOAT) lineBreakMode:UILineBreakModeWordWrap];
titleLabel.numberOfLines =ceil(labelSizeForLinesT.height/labelSizeForheightT.height);
titleCellCount = titleLabel.numberOfLines;
titleCellCountHight=labelSizeForLinesT.height;
//NSLog(@"Tcount:%d Thight:%d",titleCellCount,titleCellCountHight);
if(app.moudle.JUDGETEACHERSTUDENT == COMMUNICATION_ATHERS)
{
if(tableViewCellCount<=1)
{
if(titleCellCount<=1)
{
return 110;
}
else
{
return 110+titleCellCountHight-21;
}
}
else
{
if(titleCellCount<=1)
{
return 110+tableViewCellCountHight-16;
}
else
{
return 110+tableViewCellCountHight-16+titleCellCountHight-21;
}
}
}
else
{
return 53;
}
}
else if(indexPath.row == app.moudle.specificNoticeCount)
{
return 30;
}
else
{
return 20;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//do something
}