Contentsize, Contentoffset, and Contentinsert properties for Uiscrollview in iOS

Source: Internet
Author: User

In iOS, Uiscrollview inherits from UIView, extending the scrolling, zooming, and dual protocols, where the most common uitableview are inherited from the class.

Uiscrollview frame, bounds, contentsize, Contentoffset, and Contentinset properties, these properties have always been easy to confuse, their own small summary:

Frame is created based on the Superview coordinate system and represents the position of the scroll view in its parent view

The Bounds property is based on the coordinate system of the scrolling view itself and is primarily used to determine the position of its child view on the scroll view, and when the bounds property changes, its child views move (not commonly used on scrolling views)

Contentsize is a view that Uiscrollerview can scroll. Frame represents the size of the scrolling view itself, while contentsize represents the size that can be scrolled on a scrolling view, and when contentsize is smaller than frame, it cannot be scrolled, and when contentsize is larger than frame, it can be scrolled.

Contentoffset is the offset of the vertex of the current display area relative to the frame vertex, where bounds is a coordinate system change, contentoffset the coordinate system does not change, and the coordinates change

Contentinset's API documentation is interpreted as "the distance that the content view is embedded in the closed scrolling view." It can be understood that the size of the four edges of the content view is extended up or down. The Contentinset unit is uiedgeinsets, with the default value of Uiedgeinsetszero, which is the edge without expansion. The following explains Uiedgeinsets, which is a struct, defined as follows:

    1. typedef struct {
    2. CGFloat top, left, bottom, right;
    3. }


The values representing the upper boundary, the left boundary, the bottom boundary, the right boundary, and the extended value are respectively represented.

Borrow a picture from the Stanford University iphone tutorial

Contentsize, Contentoffset, and Contentinsert properties for Uiscrollview in iOS

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.