What is the difference between "tableView.contentSize" and "tableView.frame.size"

tableView.setContentOffset(CGPointMake(0, tableView.contentSize.height - tableView.frame.size.height), animated: true) 

This works, but I wonder what these two values ​​are tableView.contentSize : tableView.contentSize , tableView.frame.size

+6
source share
1 answer

contentSize is the size of the UIScrollView content, which means that it will be the size of the content (hidden and visible), while frame.size is the actual size of your tableView.

For example, let's say I have a device screen size of 568 (height), and inside it I have a UITableView (taking the entire screen) with 100 cells and a height of 50 for each of them. My tableView.frame.size.height will be equal to 568, but tableView.contentSize.height will be equal to the scroll size of all cells, therefore 5000.

Also, as @Ethaan suggested, read this one to go deeper.

+12
source

Source: https://habr.com/ru/post/981704/


All Articles