UISrollView, uiscrollview Scrolling up and down

Source: Internet
Author: User

UISrollView, uiscrollview Scrolling up and down
1. contentOffset

The default value is CGPointZero, which is used to set the scrollView's scroll offset.

// Sets the scrollView's scroll offset.

ScrollView. contentOffset = CGPointMake (0,200 );

2. contentSize

The default value is CGSizeZero, which is used to set the scroll range of scrollView.

// Set the scrollView's scroll range

ScrollView. contentSize = CGSizeMake (self. view. bounds. size. width, self. view. bounds. size. height * 2 );

 

3. contentInset

The default value is UIEdgeInsetsZero, which is used to set the additional scrolling area of the scrollView.

// Set the additional top scroll area of the scrollView: (UIEdgeInsetsMake is set counterclockwise, top left bottom right)

ScrollView. contentInset = UIEdgeInsetsMake (100, 0, 0, 0 );

 

4. bounces

The default value is YES, which is used to set the Spring Effect of scrollView.

// Cancel the Spring Effect of scrollView

ScrollView. bounces = NO;

5. pagingEnabled

The default value is NO, which is used to set whether to enable Paging for scrollView.

// Enable Paging

ScrollView. pagingEnabled = YES;

6. scrollEnabled

The default value is YES, which is used to set whether scrollView can be rolled.

// ScrollView prohibit scrolling

ScrollView. scrollEnabled = NO;

7. showsHorizontalScrollIndicator

The default value is YES, which is used to set whether the scrollView displays a horizontal scroll bar.

// Hide the horizontal scroll bar

ScrollView. showsHorizontalScrollIndicator = NO;

8. showsVerticalScrollIndicator

The default value is YES, which is used to set whether the scrollView displays a vertical scroll bar.

// Hide the vertical scroll bar

ScrollView. showsVerticalScrollIndicator = NO;

 

9. minimumZoomScale

 

The default value is 1.0, which is used to set the minimum scale-down of scrollView.

// Sets the maximum zoom-in ratio of the subview allowed by scrollView.

ScrollView. maximumZoomScale = 2;

 

10. maximumZoomScale

The default value is 1.0, which is used to set the maximum zoom-in ratio of scrollView.

// Sets the minimum scale allowed by scrollView

ScrollView. minimumZoomScale = 0.8;

 

 

11. delegate

Class must comply with the UIScrollViewDelegate Protocol

 

ScrollView. delegate = self; declare that the scrollView proxy is me. This method is in UIScrollViewDelegate, so we need to abide by the UIScrollViewDelegate protocol.

 

11.1 When the scrollView offset changes, this method is called, that is, scrollView is called.

-(Void) scrollViewDidScroll :( UIScrollView *) scrollView;

11.2 this method is called when scrollView is scaled.

-(Void) scrollViewDidZoom :( UIScrollView *) scrollView NS_AVAILABLE_IOS (3_2 );

 

11.3 called when you are about to drag.

-(Void) scrollViewWillBeginDragging :( UIScrollView *) scrollView;

11.4 called when you are about to stop dragging

-(Void) scrollViewWillEndDragging :( UIScrollView *) scrollViewwithVelocity :( CGPoint) velocity targetContentOffset :( inout CGPoint *) targetContentOffset NS_AVAILABLE_IOS (5_0 );

11.5 called when you stop dragging.

-(Void) scrollViewDidEndDragging :( UIScrollView *) scrollViewwillDecelerate :( BOOL) decelerate;

 

11.6 is called when the slowdown is completed.

-(Void) scrollViewWillBeginDecelerating :( UIScrollView *) scrollView;

11.7 called when the slowdown is complete

-(Void) scrollViewDidEndDecelerating :( UIScrollView *) scrollView;

 

 

 

11.8 return the view to be scaled. The view must be a subview in scrollView.

-(UIView *) viewForZoomingInScrollView :( UIScrollView *) scrollView;

 

// Columns such:

-(UIView *) viewForZoomingInScrollView :( UIScrollView *) scrollView

{

Return scrollView. subviews [0];

}

 

11.9 scrollView scaling is about to begin

-(Void) scrollViewWillBeginZooming :( UIScrollView *) scrollViewwithView :( UIView *) viewNS_AVAILABLE_IOS (3_2 );

11.10 scrollView Scaling

-(Void) scrollViewDidEndZooming :( UIScrollView *) scrollView withView :( UIView *) view atScale :( float) scale;

11.11 when pagination is not enabled, the proxy method call sequence is as follows:

ScrollViewWillBeginDragging-> scrollViewDidScroll-> scrollViewWillEndDragging-> scrollViewDidEndDragging

 

11.12 proxy method call sequence when paging is enabled

ScrollViewWillBeginDragging-> scrollViewDidScroll-> scrollViewDidEndDragging-> scrollViewWillBeginDecelerating-> scrollViewDidScroll-> scrollViewDidEndDecelerating

 

12. directionalLockEnabled

Whether the control can only scroll in one direction

 

13. decelerationRate

Change the position of the scrollerView deceleration point

14. tracking

Monitor whether the current target is being tracked

15. dragging

Change the position of the scrollerView deceleration point

16. delaysContentTouches

 

Determines whether the view delays calling the method to start rolling.

17. canCancelContentTouches

Controls whether the control is exposed to events that cancel touch.

18. indicatorStyle

Set the scroll bar style

19. decelerating

Monitor whether the current target is slowing down

 

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.