IOS ScrollView Knowledge points

Source: Internet
Author: User

? ? first, the knowledge point simple introduction

What is a 1.UIScrollView control?

(1) The screen of the mobile device? Small is extremely limited, so direct exhibition, the content of the user's eyes is also very limited

(2) When the exhibition shows more content than a screen, the user can scroll through gestures to see what's outside of the screen

(3) Ordinary UIView does not have scrolling function, can not display too much content

(4) Uiscrollview is a scrollable view control that can be used to show a lot of content, and can scroll to see all the content

(5) Example: "Settings" on the phone, other? sample programs ? ?

Simple use of 2.UIScrollView

(1) Add the content that needs to show to Uiscrollview

(2) Set the Contentsize property of the Uiscrollview, tell Uiscrollview all the contents of the ruler, that is, to tell it the range of scrolling (how far to roll, where to roll to the end)

3. Properties

(1) Common properties:

1) @property (nonatomic) Cgpointcontentoffset; This property is used to display uiscrollview scrolling position

2) @property (nonatomic) cgsizecontentsize; This property is used to uiscrollview The contents of the table, scroll range (how far to roll)

3) @property (nonatomic) Uiedgeinsetscontentinset; This property is capable of adding additional scrolling areas for 4 weeks of Uiscrollview

(2) Other properties:

1) @property (nonatomic) BOOL bounces; Set Uiscrollview If spring effect is required

2) @property (nonatomic,getter=isscrollenabled) boolscrollenabled; Sets whether Uiscrollview can scroll

3) @property (nonatomic) BOOL showshorizontalscrollindicator; Do you have a display? Horizontal scroll bar

4) @property (nonatomic) BOOL showsverticalscrollindicator; Do you want to show the vertical scroll bar?

4. Attention points

? If Uiscrollview cannot scroll, the following may be the reason:

(1) No setup contentsize

(2) scrollenabled = NO

(3) No Touch event Received: userinteractionenabled = no

(4) No cancellation of AutoLayout function (if you want to scrollview scrolling, you must cancel AutoLayout)


IOS ScrollView Knowledge points

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.