MMMScrollViewShadows

Objective-C

@interface MMMScrollViewShadows : NSObject

Swift

class MMMScrollViewShadows : NSObject

A helper for adding top and bottom shadows into any UIScrollView-based class. You create an instance in your subclass and forward calls from layoutSubviews.

  • Undocumented

    Declaration

    Objective-C

    - (nonnull id)initWithScrollView:(nonnull UIScrollView *)scrollView
    	settings:(nonnull MMMScrollViewShadowsSettings *)settings NS_DESIGNATED_INITIALIZER;

    Swift

    init(scrollView: UIScrollView, settings: MMMScrollViewShadowsSettings)
  • Unavailable

    Undocumented

    Declaration

    Objective-C

    - (nonnull id)init NS_UNAVAILABLE;
  • Have to be called from layoutSubviews of our scroll view subclass to update the state of the shadows.

    Declaration

    Objective-C

    - (void)layoutSubviews;

    Swift

    func layoutSubviews()
  • YES, if additional content view clipping might be needed for the current shadow settings.

    Declaration

    Objective-C

    - (BOOL)mightNeedClippingView;

    Swift

    func mightNeedClippingView() -> Bool
  • Same as layoutSubviews above but also updates clipToBounds property of the given view in case there are visible

    • shadows that are not flush with the edges of our scroll view, i.e. when top/bottomShadowShouldUseContentInsets
    • are used with settings and the corresponding insets are not zero now.

    Declaration

    Objective-C

    - (void)layoutSubviewsWithClippingView:(nullable UIView *)clippingView;

    Swift

    func layoutSubviews(withClippingView clippingView: UIView?)