Provide some benefits to new iOS developers, and briefly describe the attributes and usage of UIScrollView

Source: Internet
Author: User

The default value of contentOffset is CGPointZero, which is used to set the scroll offset of scrollView. // Set the scrollView's scroll offset scrollView. contentOffset = CGPointMake (0,200); 2. contentSize: CGSizeZero by default, used to set the scrollView's scroll range. // Set the scrollView's scroll range to 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 scrollView: (UIEdgeInsetsMake is set counterclockwise, top left bottom right) scrollView. contentInset = UIEdgeInsetsMake (100, 0, 0, 0); 4. bounces is YES by default, which is used to set the Spring Effect of scrollView // cancel the Spring Effect scrollView of scrollView. bounces = NO; 5. the default value of pagingEnabled is NO, which is used to set whether to enable Paging for scrollView. // enable paging scrollView. pagingEnabled = YES; 6. the default value of scrollEnabled is YES, which is used to set whether scrollView can be rolled. // scrollView: Do not scroll scrollView. scrollEnabled = NO; 7. showsHorizontalScrollIndi The default value of cator is YES, which is used to set whether the scrollView displays a horizontal scroll bar. // hide the horizontal scroll bar scrollView. showsHorizontalScrollIndicator = NO; 8. the default value of showsVerticalScrollIndicator is YES, which is used to set whether the scrollView displays a vertical scroll bar. // hide the scrollView of the vertical scroll bar. showsVerticalScrollIndicator = NO; 9. minimumZoomScale is 1.0 by default, which is used to set the minimum scale-down of scrollView. // set scrollView to allow the maximum zoom-in ratio of the subview to scrollView. maximumZoomScale = 2; 10. maximumZoomScale is 1.0 by default, which is used to set the maximum zoom-in ratio of scrollView. // sets scrollView to allow the minimum zoom ratio of the subview (scr ). OllView. minimumZoomScale = 0.8; 11. the delegate class must comply with the UIScrollViewDelegate protocol scrollView. delegate = self; declare that the scrollView proxy is the current controller. This method is in UIScrollViewDelegate, so we need to follow the UIScrollViewDelegate protocol 11.1. This method is called when the scrollView offset changes, that is, scrollView is called. -(Void) scrollViewDidScroll :( UIScrollView *) scrollView; 11.2 this method is called when scrollView is scaled-(void) scrollViewDidZoom :( UIScrollView *) scrollView lag (3_2 ); 11.3 called when you are about to drag. -(void) Resume :( UIScrollView *) scrollView; 11.4 call-(void) Resume (UIScrollView *) scrollView withVelocity :( CGPoint) velocity targetContentOffset :( inout CGPoint *) Resume Et NS_AVAILABLE_IOS (5_0); 11.5 called when you stop dragging. -(Void) scrollViewDidEndDragging :( UIScrollView *) scrollView willDecelerate :( BOOL) decelerate; 11.6 is called when the deceleration is completed. -(Void) scrollViewWillBeginDecelerating :( UIScrollView *) scrollView; call-(void) scrollViewDidEndDecelerating: (UIScrollView *) scrollView; 11.7 return the view to be scaled, this view must be a subview in scrollView. -(UIView *) viewForZoomingInScrollView :( UIScrollView *) scrollView; // The column is:-(UIView *) viewForZoomingInScrollView :( UIScrollView *) scrollView {return scrollView. subviews [0];} 11.9 scrollView scaling is about to begin-(void) preview :( UIScrollView *) scrollView withView :( UIView *) view NS_AVAILABLE_IOS (3_2); 11.10 scrollView scaling-(void) scrollViewDidEndZooming :( UIScrollView *) scrollView withView :( UIView *) view atScale :( float) scale; 11.11 proxy method call sequence when paging is not enabled: callback-> scrollViewDidScroll-> scrollViewWillEndDragging-> callback 11.12: When paging is enabled, the proxy method is called in sequence-> scrollViewDidScroll-> scrollViewDidEndDragging-> callback-> scrollViewDidScroll->. directionalLockEnabled specifies whether the control can only scroll in one direction. 13. the decelerationRate changes the position of the scrollerView deceleration point. 14. tracking monitors whether the current target is being tracked 15. dragging changes the position of the scrollerView's deceleration Point 16. delaysContentTouches controls whether the view delays calling the method to Start scrolling 17. cancancancelcontenttouches controls whether the control is exposed to events that cancel touch 18. indicatorStyle: Set the scroll bar style 19. decelerating monitoring 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.