I am trying to set dynamic height of table. But it is not working when I log height of table it is showing me dynamic height but not set to actual table.
Here is my code:
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];
Out Put:
when I uncheck autolayout it will work but it is just showing more part than previous.
if you are using AutoLayout then you can't set frames - if you do that you get wiered behaviour
Autolayout is sort of relative approach of placing UI components on screen. For e.g Stand 100px behind me and 20px from left boundary (here i have used pixel - you can think of as meters think of it as playground)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments