• 【iOS 入门】UIScrollView


    作用:

    • 让用户拖动视图以显示更多内容区域。滚动内容。
    • 让用户使用捏合手势放大或缩小所显示的内容。--区别于android 的目的。

    UIScrollView不包含任何视图用以显示其内容,只能滚动其子视图。

    子类:

      UITableView

      UICollectionView

      UITextView

    使用:

      必须配置以下两项:

    • 必须设定contentSize属性。contentSize属性用于指定滚动视图可以滚动的区域。
    • 必须为滚动视图添加一个或多个视图,滚动视图用这些视图显示内容和实现滚动。
    自iOS10开始,UIScrollView增加了refreshControl属性,用于把配置好的UIRefreshControl赋值给该属性,
    这样UIScrollView就有了下拉刷新功能。在此之前,只能在UITableViewController中使用系统提供的下拉刷新功能
       //setup scroll view
        sv.bounces = YES ;
        //下面两个在子视小于sv时能否拖动。条件是sv.bounces = YES
        sv.alwaysBounceVertical = YES ;
        sv.alwaysBounceHorizontal = YES ;
        //滑动时每一滚动一屏,一屏大小为sv.contentSize的倍数 。
        sv.pagingEnabled = YES;
        //显示滚动条
        sv.showsHorizontalScrollIndicator = YES;

     想要某相方向不能回弹或滚动

    禁止UIScrollView垂直方向滚动,只允许水平方向滚动
    //设置某个方向的内容大小为0.不影响显示。
    scrollview.contentSize =  CGSizeMake(你要的长度, 0);
    
    禁止UIScrollView水平方向滚动,只允许垂直方向滚动
    scrollview.contentSize =  CGSizeMake(0, 你要的宽度);

     //一些属性解释

    UIScrollView 的contentSize:设置UIScrollView的内容尺寸大小
    UIScrollView的frame :设置UIScrollView的位置和尺寸
    UIScrollView的contentInset:该属性是一个UIEdeInsets类型的值,UIEdeInsets并不是一个类,而是一个结构体,它包含top、left、buttom、right四个成员变量,分别代表UIScrollView所需要显示内容在上、下、左、右的留白。
    UIScrollView的contentOffset:该属性
    UIScrollView的一些属性值
    tracking
    当 touch 后还没有拖动的时候值是YES,否则NO
    
    scroller.pagingEnabled=YES;
    UIScrollView会被分割成多个独立页面,用户的滚动体验则变成了页面翻转
    
    zoomBouncing
    当内容放大到最大或者最小的时候值是 YES,否则 NO
    
    zooming
    当正在缩放的时候值是 YES,否则 NO
    
    decelerating
    当滚动后,手指放开但是还在继续滚动中。这个时候是 YES,其它时候是 NO
    
    decelerationRate
    设置手指放开后的减速率
    
    maximumZoomScale
    一个浮点数,表示能放最大的倍数
    
    minimumZoomScale
    一个浮点数,表示能缩最小的倍数
    
    pagingEnabled
    当值是 YES 会自动滚动到 subview 的边界。默认是NO
    
    scrollEnabled
    决定是否可以滚动
    
    delaysContentTouches
    是个布尔值,当值是 YES 的时候,用户触碰开始,scroll view要延迟一会,看看是否用户有意图滚动。假如滚动了,那么捕捉 touch-down 事件,否则就不捕捉。假如值是NO,当用户触碰, scroll view 会立即触发 touchesShouldBegin:withEvent:inContentView:,默认是 YES
    
    canCancelContentTouches
    当值是 YES 的时候,用户触碰后,然后在一定时间内没有移动,scrollView 发送 tracking events,然后用户移动手指足够长度触发滚动事件,这个时候,scrollView 发送了 touchesCancelled:withEvent: 到 subview,然后 scrollView 开始滚动。假如值是 NO,scrollView 发送 tracking events 后,就算用户移动手指,scrollView 也不会滚动。
    
    contentSize
    里面内容的大小,也就是可以滚动的大小,默认是0,没有滚动效果。
    
    showsHorizontalScrollIndicator
    滚动时是否显示水平滚动条
    
    showsVerticalScrollIndicator
    滚动时是否显示垂直滚动条
    
    bounces(弹簧效果)
    默认是 yes,就是滚动超过边界会反弹有反弹回来的效果。假如是 NO,那么滚动到达边界会立刻停止。
    
    bouncesZoom
    和 bounces 类似,区别在于:这个效果反映在缩放上面,假如缩放超过最大缩放,那么会反弹效果;假如是 NO,则到达最大或者最小的时候立即停止。
    
    directionalLockEnabled
    默认是 NO,可以在垂直和水平方向同时运动。当值是 YES 时,假如一开始是垂直或者是水平运动,那么接下来会锁定另外一个方向的滚动。 假如一开始是对角方向滚动,则不会禁止某个方向
    
    indicatorStyle
    滚动条的样式,基本只是设置颜色。总共3个颜色:默认、黑、白
    
    scrollIndicatorInsets
    设置滚动条的位置
    
    UIScrollerViewDelegate代理方法
    //scrollView滚动时,就调用该方法。任何offset值改变都调用该方法。即滚动过程中,调用多次
    
    (void)scrollViewDidScroll:(UIScrollView*)scrollView{
    
    NSLog(@"scrollViewDidScroll");
    CGPoint point=scrollView.contentOffset;
    NSLog(@"%f,%f",point.x,point.y);
    // 从中可以读取contentOffset属性以确定其滚动到的位置。
    
    // 注意:当ContentSize属性小于Frame时,将不会出发滚动
    
    }
    
    // 当scrollView缩放时,调用该方法。在缩放过程中,回多次调用
    
    (void)scrollViewDidZoom:(UIScrollView *)scrollView{
    
    NSLog(@"scrollViewDidScroll");
    float value=scrollView.zoomScale;
    NSLog(@"%f",value);
    
    }
    
    // 当开始滚动视图时,执行该方法。一次有效滑动(开始滑动,滑动一小段距离,只要手指不松开,只算一次滑动),只执行一次。
    
    (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
    
    NSLog(@"scrollViewWillBeginDragging");
    
    }
    
    // 滑动scrollView,并且手指离开时执行。一次有效滑动,只执行一次。
    // 当pagingEnabled属性为YES时,不调用,该方法
    
    (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset{
    
    NSLog(@"scrollViewWillEndDragging");
    
    }
    
    // 滑动视图,当手指离开屏幕那一霎那,调用该方法。一次有效滑动,只执行一次。
    // decelerate,指代,当我们手指离开那一瞬后,视图是否还将继续向前滚动(一段距离),经过测试,decelerate=YES
    
    (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{
    
    NSLog(@"scrollViewDidEndDragging");
    if (decelerate) {
    NSLog(@"decelerate");
    }else{
    NSLog(@"no decelerate");
    
    }
    
    CGPoint point=scrollView.contentOffset;
    NSLog(@"%f,%f",point.x,point.y);
    
    }
    
    // 滑动减速时调用该方法。
    
    (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView{
    
    NSLog(@"scrollViewWillBeginDecelerating");
    // 该方法在scrollViewDidEndDragging方法之后。
    
    }
    
    // 滚动视图减速完成,滚动将停止时,调用该方法。一次有效滑动,只执行一次。
    
    (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
    
    NSLog(@"scrollViewDidEndDecelerating");
    
    [_scrollView setContentOffset:CGPointMake(0, 500) animated:YES];
    
    }
    
    // 当滚动视图动画完成后,调用该方法,如果没有动画,那么该方法将不被调用
    
    (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView{
    
    NSLog(@"scrollViewDidEndScrollingAnimation");
    // 有效的动画方法为:
    // - (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated 方法
    // - (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated 方法
    
    }
    
    // 返回将要缩放的UIView对象。要执行多次
    
    (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView{
    
    NSLog(@"viewForZoomingInScrollView");
    return self.imgView;
    
    }
    
    // 当将要开始缩放时,执行该方法。一次有效缩放,就只执行一次。
    
    (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view{
    
    NSLog(@"scrollViewWillBeginZooming");
    
    }
    
    // 当缩放结束后,并且缩放大小回到minimumZoomScale与maximumZoomScale之间后(我们也许会超出缩放范围),调用该方法。
    
    (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale{
    
    NSLog(@"scrollViewDidEndZooming");
    
    }
    
    // 指示当用户点击状态栏后,滚动视图是否能够滚动到顶部。
    //如果你不是完全滚动到滚轴视图的顶部,你可以轻点状态栏,那个可视的滚轴视图会一直滚动到顶部,那是默认行为,你可以通过该方法返回NO来关闭它
    //需要设置滚动视图的属性:_scrollView.scrollsToTop=YES;
    
    (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView{
    
    return YES;
    
    }
    
    // 当滚动视图滚动到最顶端后,执行该方法
    
    (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView{
    
    NSLog(@"scrollViewDidScrollToTop");
    }
    #import <Foundation/Foundation.h>
    #import <CoreGraphics/CoreGraphics.h>
    #import <UIKit/UIView.h>
    #import <UIKit/UIGeometry.h>
    #import <UIKit/UIKitDefines.h>
    #import <UIKit/UIRefreshControl.h>
    
    NS_ASSUME_NONNULL_BEGIN
    
    //指示品样式 typedef NS_ENUM(NSInteger, UIScrollViewIndicatorStyle) { UIScrollViewIndicatorStyleDefault,
    // Automatically switches appearance based on the user interface style UIScrollViewIndicatorStyleBlack, // Dark indicator, for use on light backgrounds UIScrollViewIndicatorStyleWhite // Light indicator, for use on dark backgrounds }; //键盘关闭方式 typedef NS_ENUM(NSInteger, UIScrollViewKeyboardDismissMode) { UIScrollViewKeyboardDismissModeNone, UIScrollViewKeyboardDismissModeOnDrag, // dismisses the keyboard when a drag begins UIScrollViewKeyboardDismissModeInteractive, // the keyboard follows the dragging touch off screen, and may be pulled upward again to cancel the dismiss } API_AVAILABLE(ios(7.0)); typedef NS_ENUM(NSInteger, UIScrollViewIndexDisplayMode) { UIScrollViewIndexDisplayModeAutomatic, // the index will show or hide automatically as needed UIScrollViewIndexDisplayModeAlwaysHidden, // the index will never be displayed } API_AVAILABLE(tvos(10.2)); typedef NS_ENUM(NSInteger, UIScrollViewContentInsetAdjustmentBehavior) { UIScrollViewContentInsetAdjustmentAutomatic, // Similar to .scrollableAxes, but for backward compatibility will also adjust the top & bottom contentInset when the scroll view is owned by a view controller with automaticallyAdjustsScrollViewInsets = YES inside a navigation controller, regardless of whether the scroll view is scrollable UIScrollViewContentInsetAdjustmentScrollableAxes, // Edges for scrollable axes are adjusted (i.e., contentSize.width/height > frame.size.width/height or alwaysBounceHorizontal/Vertical = YES) UIScrollViewContentInsetAdjustmentNever, // contentInset is not adjusted UIScrollViewContentInsetAdjustmentAlways, // contentInset is always adjusted by the scroll view's safeAreaInsets } API_AVAILABLE(ios(11.0),tvos(11.0)); typedef CGFloat UIScrollViewDecelerationRate NS_TYPED_ENUM; UIKIT_EXTERN const UIScrollViewDecelerationRate UIScrollViewDecelerationRateNormal API_AVAILABLE(ios(3.0)); UIKIT_EXTERN const UIScrollViewDecelerationRate UIScrollViewDecelerationRateFast API_AVAILABLE(ios(3.0)); @class UIEvent, UIImageView, UIPanGestureRecognizer, UIPinchGestureRecognizer; @protocol UIScrollViewDelegate; UIKIT_EXTERN API_AVAILABLE(ios(2.0)) @interface UIScrollView : UIView <NSCoding, UIFocusItemScrollableContainer> @property(nonatomic) CGPoint contentOffset; // default CGPointZero @property(nonatomic) CGSize contentSize; // default CGSizeZero @property(nonatomic) UIEdgeInsets contentInset; // default UIEdgeInsetsZero. add additional scroll area around content /* When contentInsetAdjustmentBehavior allows, UIScrollView may incorporate its safeAreaInsets into the adjustedContentInset. */ @property(nonatomic, readonly) UIEdgeInsets adjustedContentInset API_AVAILABLE(ios(11.0),tvos(11.0)); /* Also see -scrollViewDidChangeAdjustedContentInset: in the UIScrollViewDelegate protocol. */ - (void)adjustedContentInsetDidChange API_AVAILABLE(ios(11.0),tvos(11.0)) NS_REQUIRES_SUPER; /* Configure the behavior of adjustedContentInset. Default is UIScrollViewContentInsetAdjustmentAutomatic. */ @property(nonatomic) UIScrollViewContentInsetAdjustmentBehavior contentInsetAdjustmentBehavior API_AVAILABLE(ios(11.0),tvos(11.0)); /* Configures whether the scroll indicator insets are automatically adjusted by the system. Default is YES. */ @property(nonatomic) BOOL automaticallyAdjustsScrollIndicatorInsets API_AVAILABLE(ios(13.0), tvos(13.0)); /* contentLayoutGuide anchors (e.g., contentLayoutGuide.centerXAnchor, etc.) refer to the untranslated content area of the scroll view. */ @property(nonatomic,readonly,strong) UILayoutGuide *contentLayoutGuide API_AVAILABLE(ios(11.0),tvos(11.0)); /* frameLayoutGuide anchors (e.g., frameLayoutGuide.centerXAnchor) refer to the untransformed frame of the scroll view. */ @property(nonatomic,readonly,strong) UILayoutGuide *frameLayoutGuide API_AVAILABLE(ios(11.0),tvos(11.0)); @property(nullable,nonatomic,weak) id<UIScrollViewDelegate> delegate; // default nil. weak reference @property(nonatomic,getter=isDirectionalLockEnabled) BOOL directionalLockEnabled; // default NO. if YES, try to lock vertical or horizontal scrolling while dragging @property(nonatomic) BOOL bounces; // default YES. if YES, bounces past edge of content and back again ->YES时候会弹回。 @property(nonatomic) BOOL alwaysBounceVertical; // default NO. if YES and bounces is YES, even if content is smaller than bounds, allow drag vertically @property(nonatomic) BOOL alwaysBounceHorizontal; // default NO. if YES and bounces is YES, even if content is smaller than bounds, allow drag horizontally //以上三个设置单向可以拖动 。bounces = “YES”,alwaysBounceVertical=YES;两个配合,控制单方向可以滑动。


    @property(nonatomic,getter=isPagingEnabled) BOOL pagingEnabled API_UNAVAILABLE(tvos);// default NO. if YES, stop on multiples of view bounds @property(nonatomic,getter=isScrollEnabled) BOOL scrollEnabled; // default YES. turn off any dragging temporarily @property(nonatomic) BOOL showsVerticalScrollIndicator; // default YES. show indicator while we are tracking. fades out after tracking @property(nonatomic) BOOL showsHorizontalScrollIndicator; // default YES. show indicator while we are tracking. fades out after tracking @property(nonatomic) UIScrollViewIndicatorStyle indicatorStyle; // default is UIScrollViewIndicatorStyleDefault @property(nonatomic) UIEdgeInsets verticalScrollIndicatorInsets API_AVAILABLE(ios(11.1), tvos(11.1)); // default is UIEdgeInsetsZero. @property(nonatomic) UIEdgeInsets horizontalScrollIndicatorInsets API_AVAILABLE(ios(11.1), tvos(11.1)); // default is UIEdgeInsetsZero. @property(nonatomic) UIEdgeInsets scrollIndicatorInsets; // use the setter only, as a convenience for setting both verticalScrollIndicatorInsets and horizontalScrollIndicatorInsets to the same value. if those properties have been set to different values, the return value of this getter (deprecated) is undefined. - (UIEdgeInsets)scrollIndicatorInsets API_DEPRECATED("The scrollIndicatorInsets getter is deprecated, use the verticalScrollIndicatorInsets and horizontalScrollIndicatorInsets getters instead.", ios(2.0, 13.0), tvos(9.0, 13.0)); @property(nonatomic) UIScrollViewDecelerationRate decelerationRate API_AVAILABLE(ios(3.0)); @property(nonatomic) UIScrollViewIndexDisplayMode indexDisplayMode API_AVAILABLE(tvos(10.2)); - (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated; // animate at constant velocity to new offset - (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated; // scroll so rect is just visible (nearest edges). nothing if rect completely visible - (void)flashScrollIndicators; // displays the scroll indicators for a short time. This should be done whenever you bring the scroll view to front. /* Scrolling with no scroll bars is a bit complex. on touch down, we don't know if the user will want to scroll or track a subview like a control. on touch down, we start a timer and also look at any movement. if the time elapses without sufficient change in position, we start sending events to the hit view in the content subview. if the user then drags far enough, we switch back to dragging and cancel any tracking in the subview. the methods below are called by the scroll view and give subclasses override points to add in custom behaviour. you can remove the delay in delivery of touchesBegan:withEvent: to subviews by setting delaysContentTouches to NO. */ @property(nonatomic,readonly,getter=isTracking) BOOL tracking; // returns YES if user has touched. may not yet have started dragging @property(nonatomic,readonly,getter=isDragging) BOOL dragging; // returns YES if user has started scrolling. this may require some time and or distance to move to initiate dragging @property(nonatomic,readonly,getter=isDecelerating) BOOL decelerating; // returns YES if user isn't dragging (touch up) but scroll view is still moving @property(nonatomic) BOOL delaysContentTouches; // default is YES. if NO, we immediately call -touchesShouldBegin:withEvent:inContentView:. this has no effect on presses @property(nonatomic) BOOL canCancelContentTouches; // default is YES. if NO, then once we start tracking, we don't try to drag if the touch moves. this has no effect on presses // override points for subclasses to control delivery of touch events to subviews of the scroll view // called before touches are delivered to a subview of the scroll view. if it returns NO the touches will not be delivered to the subview // this has no effect on presses // default returns YES - (BOOL)touchesShouldBegin:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event inContentView:(UIView *)view; // called before scrolling begins if touches have already been delivered to a subview of the scroll view. if it returns NO the touches will continue to be delivered to the subview and scrolling will not occur // not called if canCancelContentTouches is NO. default returns YES if view isn't a UIControl // this has no effect on presses - (BOOL)touchesShouldCancelInContentView:(UIView *)view; /* the following properties and methods are for zooming. as the user tracks with two fingers, we adjust the offset and the scale of the content. When the gesture ends, you should update the content as necessary. Note that the gesture can end and a finger could still be down. While the gesture is in progress, we do not send any tracking calls to the subview. the delegate must implement both viewForZoomingInScrollView: and scrollViewDidEndZooming:withView:atScale: in order for zooming to work and the max/min zoom scale must be different note that we are not scaling the actual scroll view but the 'content view' returned by the delegate. the delegate must return a subview, not the scroll view itself, from viewForZoomingInScrollview: */ @property(nonatomic) CGFloat minimumZoomScale; // default is 1.0 @property(nonatomic) CGFloat maximumZoomScale; // default is 1.0. must be > minimum zoom scale to enable zooming @property(nonatomic) CGFloat zoomScale API_AVAILABLE(ios(3.0)); // default is 1.0 - (void)setZoomScale:(CGFloat)scale animated:(BOOL)animated API_AVAILABLE(ios(3.0)); - (void)zoomToRect:(CGRect)rect animated:(BOOL)animated API_AVAILABLE(ios(3.0)); @property(nonatomic) BOOL bouncesZoom; // default is YES. if set, user can go past min/max zoom while gesturing and the zoom will animate to the min/max value at gesture end @property(nonatomic,readonly,getter=isZooming) BOOL zooming; // returns YES if user in zoom gesture @property(nonatomic,readonly,getter=isZoomBouncing) BOOL zoomBouncing; // returns YES if we are in the middle of zooming back to the min/max value // When the user taps the status bar, the scroll view beneath the touch which is closest to the status bar will be scrolled to top, but only if its `scrollsToTop` property is YES, its delegate does not return NO from `-scrollViewShouldScrollToTop:`, and it is not already at the top. // On iPhone, we execute this gesture only if there's one on-screen scroll view with `scrollsToTop` == YES. If more than one is found, none will be scrolled. @property(nonatomic) BOOL scrollsToTop API_UNAVAILABLE(tvos); // default is YES. // Use these accessors to configure the scroll view's built-in gesture recognizers. // Do not change the gestures' delegates or override the getters for these properties. // Change `panGestureRecognizer.allowedTouchTypes` to limit scrolling to a particular set of touch types. @property(nonatomic, readonly) UIPanGestureRecognizer *panGestureRecognizer API_AVAILABLE(ios(5.0)); // `pinchGestureRecognizer` will return nil when zooming is disabled. @property(nullable, nonatomic, readonly) UIPinchGestureRecognizer *pinchGestureRecognizer API_AVAILABLE(ios(5.0)); // `directionalPressGestureRecognizer` is disabled by default, but can be enabled to perform scrolling in response to up / down / left / right arrow button presses directly, instead of scrolling indirectly in response to focus updates. @property(nonatomic, readonly) UIGestureRecognizer *directionalPressGestureRecognizer API_DEPRECATED("Configuring the panGestureRecognizer for indirect scrolling automatically supports directional presses now, so this property is no longer useful.", tvos(9.0, 11.0)); @property(nonatomic) UIScrollViewKeyboardDismissMode keyboardDismissMode API_AVAILABLE(ios(7.0)); // default is UIScrollViewKeyboardDismissModeNone @property (nonatomic, strong, nullable) UIRefreshControl *refreshControl API_AVAILABLE(ios(10.0)) API_UNAVAILABLE(tvos); @end @protocol UIScrollViewDelegate<NSObject> @optional - (void)scrollViewDidScroll:(UIScrollView *)scrollView; // any offset changes - (void)scrollViewDidZoom:(UIScrollView *)scrollView API_AVAILABLE(ios(3.2)); // any zoom scale changes // called on start of dragging (may require some time and or distance to move) - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView; // called on finger up if the user dragged. velocity is in points/millisecond. targetContentOffset may be changed to adjust where the scroll view comes to rest - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset API_AVAILABLE(ios(5.0)); // called on finger up if the user dragged. decelerate is true if it will continue moving afterwards - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate; - (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView; // called on finger up as we are moving - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView; // called when scroll view grinds to a halt - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView; // called when setContentOffset/scrollRectVisible:animated: finishes. not called if not animating - (nullable UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView; // return a view that will be scaled. if delegate returns nil, nothing happens - (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(nullable UIView *)view API_AVAILABLE(ios(3.2)); // called before the scroll view begins zooming its content - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(nullable UIView *)view atScale:(CGFloat)scale; // scale between minimum and maximum. called after any 'bounce' animations - (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView; // return a yes if you want to scroll to the top. if not defined, assumes YES - (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView; // called when scrolling animation finished. may be called immediately if already at top /* Also see -[UIScrollView adjustedContentInsetDidChange] */ - (void)scrollViewDidChangeAdjustedContentInset:(UIScrollView *)scrollView API_AVAILABLE(ios(11.0), tvos(11.0)); @end NS_ASSUME_NONNULL_END #else #import <UIKitCore/UIScrollView.h> #endif



  • 相关阅读:
    玩家的numpertpry 对象 中 不仅仅要同步 君主武将的等级,阶级也要同步
    synchronized 的真正含义
    学习笔记——WPF
    学习笔记——AOP
    好记性不如烂笔头——WebService与Remoting
    好记性不如烂笔头——垃圾回收
    “返回顶部”实现一例
    ASP.NET MVC脚本及样式压缩
    设计模式学习笔记——迭代器模式
    设计模式学习笔记——策略模式
  • 原文地址:https://www.cnblogs.com/mamamia/p/12176987.html
Copyright © 2020-2023  润新知