Frame, contentsize, Contentoffset, and Contentinset properties for iOS development Uiscrollview

Source: Internet
Author: User

iOS drop-down picture gets bigger effect

http://blog.csdn.net/mad2man/article/details/14169197

Uiscrollview frame, contentsize, Contentoffset, and Contentinset properties in iOS

(1) Frame: Refers to the visible range of the ScrollView (visible area).

(2) Contentsize: is its scroll range. Uiscrollview the ruler of all content, that is to tell it the range of scrolling (how far to roll, how far to roll)

(3) Contentinset: Add additional scrolling area for Uiscrollview. (Top, left, bottom, right) counterclockwise.

(5) Contentoffset: is a cgpoint type of structure, used to record the scroll position of the ScrollView, that is, the record "box" ran to where. Knowing this property, you know where it is, and you can control the movement of the "box" by setting this property. The coordinate value changes as the user slides the content view.

Contentinset is the position of the vertex of the ScrollView Contentview relative to the ScrollView

Set content Location {top, left, bottom, right};//add extra scrolling area (counterclockwise, up, down, right)

Scrollview.contentinset = Uiedgeinsetsmake (50, 0, 0, 0);

When this is defined, the content view begins to display coordinates (0,51)

The default point for Contentoffset is Cgpointzero

Here is a specific explanation.

Just like two overlapping sheets of paper with a 320*480 screen hole in the middle of the paper, and then the paper below can be infinitely large, showing the contents, you can move the paper through the hole to read the above information, so, understand it.

Contentoffset is the offset of the vertex of the current display area relative to the frame vertex, Uiscrollview

It is worth noting that:

1. When the contentoffset of the content view is negative, it is not visible in the scrolling view.

Contentsize is a property in ScrollView that represents a visible area in ScrollView, and if there is a scrollview, its frame is (0,0,320,480), and its contentsize is ( 320,960). That is, this scrollview the entire content size is (320,960), to see (320,480) after the content by sliding scrollview up and down.

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 480

Contentinset is the relationship between ContentView.frame.origin and Scrollview.frame.origin in ScrollView, such as Contentview's frame (0,30,320,480) , then the Contentinset is (0, 30),

Frame, contentsize, Contentoffset, and Contentinset properties for iOS development Uiscrollview

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.