【发布时间】:2014-01-10 08:43:32
【问题描述】:
我正在尝试设置表格的动态高度。但是当我记录表格高度时它不起作用,它向我显示动态高度但未设置为实际表格。
这是我的代码:
CGRect table_frame;
table_frame=table_sender.frame;
NSLog(@"table fram: %f",table_frame.size.height); //got table height 444
float height = [senderHistoryDataArray count] * 40 +40 ; // 4*25.00
NSLog(@"height of table: %f",height); //got this height 200
if(height>=444){
table_frame.size.height=444;
}
else{
table_frame.size.height=height;
NSLog(@"height set"); //also displying this line in log
}
table_sender.frame=table_frame;
[table_sender reloadData];
输出:
当我取消选中自动布局时,它会起作用,但它只是显示比以前更多的部分。
【问题讨论】:
-
我不知道你图片中的tableview框架。
-
实际上我设置了高度 444,但是当我计算高度时它是 200。但我不知道那个白色背景是什么
-
你想只改变高度表还是你在谈论自定义单元格(每个都有其他高度?)
-
不只是说桌子的高度
-
你在哪里调用你给我们看的代码?
标签: ios iphone uitableview ios7