UIScrollView(FWApplication)

@interface UIScrollView (FWApplication)

添加顶部下拉图片时,只需将该子view添加到scrollView最底层(如frame方式添加inset视图),再实现效果即可。

Content

  • 内容视图,子视图需添加到本视图,布局约束完整时可自动滚动

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NS_REFINED_FOR_SWIFT UIView *fw_contentView;

Frame

  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic) CGFloat fw_contentWidth
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic) CGFloat fw_contentHeight
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic) CGFloat fw_contentOffsetX
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic) CGFloat fw_contentOffsetY

Scroll

  • UIScrollView真正的inset,iOS11+使用adjustedContentInset,iOS11以下使用contentInset

    Declaration

    Objective-C

    @property (nonatomic, readonly) UIEdgeInsets fw_contentInset;
  • 当前滚动方向,如果多个方向滚动,取绝对值较大的一方,失败返回0

    Declaration

    Objective-C

    @property (nonatomic, readonly) UISwipeGestureRecognizerDirection fw_scrollDirection;
  • Undocumented

    Declaration

    Objective-C

    @property (nonatomic, readonly) CGFloat fw_scrollPercent
  • Undocumented

    Declaration

    Objective-C

    - (CGFloat)fw_scrollPercentOfDirection:(UISwipeGestureRecognizerDirection)direction NS_REFINED_FOR_SWIFT;

Content

Keyboard

Gesture

  • Undocumented

    Declaration

    Objective-C

    @property (nullable, nonatomic, copy) BOOL (^fw_shouldBegin
  • Undocumented

    Declaration

    Objective-C

    @property (nullable, nonatomic, copy) BOOL (^fw_shouldRecognizeSimultaneously
  • Undocumented

    Declaration

    Objective-C

    @property (nullable, nonatomic, copy) BOOL (^fw_shouldRequireFailure
  • Undocumented

    Declaration

    Objective-C

    @property (nullable, nonatomic, copy) BOOL (^fw_shouldBeRequiredToFail

Hover

  • 设置自动布局视图悬停到指定父视图固定位置,在scrollViewDidScroll:中调用即可

    Declaration

    Objective-C

    - (CGFloat)fw_hoverView:(nonnull UIView *)view
              fromSuperview:(nonnull UIView *)fromSuperview
                toSuperview:(nonnull UIView *)toSuperview
                 toPosition:(CGFloat)toPosition;

    Parameters

    view

    需要悬停的视图,须占满fromSuperview

    fromSuperview

    起始的父视图,须是scrollView的子视图

    toSuperview

    悬停的目标视图,须是scrollView的父级视图,一般控制器self.view

    toPosition

    需要悬停的目标位置,相对于toSuperview的originY位置

    Return Value

    相对于悬浮位置的距离,可用来设置导航栏透明度等

  • 快速创建通用配置滚动视图

    Declaration

    Objective-C

    + (nonnull instancetype)fw_scrollView;