How to get the correct hight and expand the table view when a tableview is in a scrollview?
I have a scrollview that contains a tableview and some other componinets, some buttons and labels. However I cannot figure out how the following two questions are addressed:
- I know how to disable the scrolling in the tableview. Nevertheless, can a开发者_开发知识库nyone tell me how to expand the tableview programmatically so the hight of the table view will not only be limited to the hight I set in interface builder?
- When it comes to deciding the contentSize of the scrollview, how do I calculate the hight of the tableview as a whole?
Thank you in advance for any thoughts.
You can set the tableView's frame and adjust the height with:
[tableView setFrame:CGRectMake(x, y, width, height)];
You can get the size of the table with:
tableView.frame.size
Reading up on CGRect will help you understand how to access the information you want from the frame or bound of a view.
精彩评论