Introduction to three properties of iOS development Uiscrollview

Source: Internet
Author: User

Contentsize belongs to cgsize type, Cgsizemake (width,height), width determines the horizontal distance of Uiscrollview scrolling, height determines the longitudinal distance of Uiscrollview scrolling, Contensize property cannot scroll the view if you do not set a value

Set up a Uiscrollview

Uiscrollview *SV = [[Uiscrollview alloc] initWithFrame:self.view.bounds];

Sv.backgroundcolor = [Uicolor Cyancolor];

[Self.view ADDSUBVIEW:SV];

Add a View

UIImage *image = [UIImage imagenamed:@ "big picture"];

Uiimageview *iv = [[Uiimageview alloc] initwithimage:image];

[SV Addsubview:iv];

Sv.contentsize = iv.bounds.size;

The added view will be larger in general resolution

Contentoffset the position of the content view offset, is the Cgpoint type, Cgpointmake (x, y), the default is Cgpointzero<==>cgpointmake (0,0), It means that the content view is relative to the view origin, the offset position, left and right scrolling, will change the value of x, scroll up and down will change the value of Y, this is in the calculation of Uiscrollview and its sub-class Uicollectionview view width or high time, very effective, Depending on the amount of x or Y offset, it is easy to calculate the height or width of each view.

Contentinset the margin around the view, Uiedgeinsets type Uiedgeinsetsmake (top,left,bottom,right); The margin around the distance, is to add a border to the view, size customization.

The knowledge is very small white, is oneself reviews some knowledge, the time question, first this.

Introduction to three properties of 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.