The difference between contentsize Contentoffset Contentinset in IOS

Source: Internet
Author: User

Contentsize is an area where scrollview can be scrolled, such as frame = (0, 0, +, 480) Contentsize = (320, 960), which means that your scrollview can scroll up and down, The scrolling area is twice times the size of the frame.  
Contentoffset is the offset of the ScrollView current display area vertex relative to the frame vertex, such as the last example you pulled to the bottom, Contentoffset is (0, 480), that is, y offset the 480 
Contentinset Is the position of the vertex of the ScrollView Contentview relative to the scrollview, such as your Contentinset = (0, 100), then your contentview is displayed from ScrollView (0, 100) 

In addition UITableView is the subclass of Uiscrollview, they are different in the above attribute, Tabelview Contentsize is implemented by the following methods . 
-(Nsinteger) numberofsections; 
-(Nsinteger) Numberofrowsinsection: (nsinteger) section; 
-(CGFloat) TableView: (UITableView *) TableView Heightforrowatindexpath: (Nsindexpath *) Indexpath; 
-(CGFloat) TableView: (UITableView *) TableView heightforheaderinsection: (nsinteger) section; 
-(CGFloat) TableView: (UITableView *) TableView heightforfooterinsection: (nsinteger) section; 
it will automatically calculate all the heights and to make the height of the contentsize for it. 

For example you're in the delegate method 
-(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (nsinteger) Section { 
return; 


The difference between contentsize Contentoffset Contentinset in IOS

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.