开发者

How to get the correct hight and expand the table view when a tableview is in a scrollview?

开发者 https://www.devze.com 2023-01-10 00:31 出处:网络
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 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:

  1. 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?
  2. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消