Skip to content

UIScrollView-LIFade is a lightweight, fancy and non-intrusive UIScrollView fade effect category.

License

Notifications You must be signed in to change notification settings

lihkg/UIScrollView-LIFade

Repository files navigation

UIScrollView-LIFade

CI Status Version License Platform

UIScrollView-LIFade is a lightweight, fancy and non-intrusive UIScrollView fade effect category.

Features

  • Lightweight: This library contains only 2 files.
  • Easy-to-use: Just one line of code can add a fade effect to any of scrollview.
  • Non-intrusive: There is no need to make the UIScrollView class inherit from other base class.
  • Category: Works on all of UIScrollView including UITextView, UITableView, UICollectionView or UI/WKWebView (scrollView), etc.

Screeshot

UIScrollView Example UITextView Example

Showcase

LIHKG Menu

Usage

UIScrollView-LIFade add a fade property to UIScrollView witch is a UIEdgeInsets to represent the fading insets.

#import "UIScrollView+LIFade.h"
UIScrollView *scrollView;
scrollView.fade = UIEdgeInsetsMake(64, 0, 64, 0); //Fade vertically (top 64 and bottom 64)
scrollView.fade = UIEdgeInsetsMake(0, 64, 0, 64); //Fade horizontally (left 64 and right 64)
scrollView.fade = UIEdgeInsetsMake(64, 64, 64, 64); //Fade 4 edges with 64
scrollView.fade = UIEdgeZero; //Remove fade effect

For webview (WKWebView or UIWebView)

WKWebView *webView;
webView.scrollView.fade = UIEdgeInsetsMake(64, 0, 64, 0);

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Only tested on iOS 8 or higher.

Installation

CocoaPods

  1. Add pod 'UIScrollView-LIFade' to your Podfile.
  2. Run pod install or pod update.

Manually

  1. Put UIScrollView+LIFade.h and UIScrollView+LIFade.m to your Xcode project.

License

UIScrollView-LIFade is available under the MIT license. See the LICENSE file for more info.