GithubHelp home page GithubHelp logo

xingql / bfpapertableviewcell Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bfeher/bfpapertableviewcell

0.0 2.0 0.0 3.41 MB

A subclass of UITableViewCell for iOS inspired by Google's Paper Material Design.

License: MIT License

bfpapertableviewcell's Introduction

BFPaperTableViewCell

CocoaPods

A subclass of UITableViewCell inspired by Google's Material Design: Paper Elements.

Animated Screenshot

About

BFPaperTableViewCell is a subclass of UITableViewCell that behaves much like the new paper table cells from Google's Material Design Labs. All animation are asynchronous and are performed on sublayers. BFPaperTableViewCells work right away with pleasing default behaviors, however they can be easily customized! The tap-circle color, background fade color, and tap-circle diameter are all readily customizable via public properties.

By default, BFPaperTableViewCells use "Smart Color" which will match the tap-circle and background fade colors to the color of the textLabel. You can turn off Smart Color by setting the property, .usesSmartColor to NO. If you disable Smart Color, a gray color will be used by default for both the tap-circle and the background color fade. You can set your own colors via: .tapCircleColor and .backgroundFadeColor. Note that setting these disables Smart Color.

Properties

BOOL usesSmartColor;
A flag to set YES to use Smart Color, or NO to use a custom color scheme. While Smart Color is the default (usesSmartColor = YES), customization is cool too.

UIColor *tapCircleColor;
The UIColor to use for the circle which appears where you tap. NOTE: Setting this defeats the "Smart Color" ability of the tap circle. Alpha values less than 1 are recommended.

UIColor *backgroundFadeColor;
The UIColor to fade the background to. NOTE: Setting this defeats the "Smart Color" ability of the background fade. An alpha value of 1 is recommended, as the fade is a constant (bfPaperCell_fadeConstant) defined in the BFPaperTableViewCell.m. This bothers me too.

CGFloat tapCircleDiameter;
The CGFloat value representing the Diameter of the tap-circle. By default it will be calculated to almost be big enough to cover up the whole background. Any value less than zero will result in default being used. Three pleasing sizes, bfPaperTableViewCell_tapCircleDiameterSmall, bfPaperTableViewCell_tapCircleDiameterMedium, and bfPaperTableViewCell_tapCircleDiameterLarge are also available for use.

BOOL rippleFromTapLocation;
A flag to set to YES to have the tap-circle ripple from point of touch. If this is set to NO, the tap-circle will always ripple from the center of the button. Default is YES.

Usage

Add the BFPaperTableViewCell header and implementation file to your project. (.h & .m)

After that, you can use it just like any other UITableViewCell.

If you use storyboards with prototype cells, be sure to change the prototype cell's class to BFPaperTableViewCell!

###Example

// Register BFPaperTableViewCell for our tableView in viewDidLoad:
- (void)viewDidLoad
{
  ...
  [self.tableView registerClass:[BFPaperTableViewCell class] forCellReuseIdentifier:@"BFPaperCell"];  // NOTE: This is not required if we declared a prototype cell in our storyboard (which this example project does). This is here purely for information purposes.
  ...
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
  BFPaperTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"BFPaperCell" forIndexPath:indexPath];
  if (!cell) {
    cell = [[BFPaperTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"BFPaperCell"];
  }
  cell.rippleFromTapLocation = NO; // Will always ripple from center if NO.
  cell.tapCircleColor = [[UIColor paperColorDeepPurple] colorWithAlphaComponent:0.3];
  cell.backgroundFadeColor = [UIColor paperColorBlue];
  cell.tapCircleDiameter = bfPaperTableViewCell_tapCircleDiameterSmall;
  cell.textLabel.backgroundColor = [UIColor clearColor];  // THIS IS SUPER IMPORTANT!! SET THIS LAST RIGHT BEFORE RETURNING.
  return cell;
}

Cocoapods

CocoaPods are the best way to manage library dependencies in Objective-C projects. Learn more at http://cocoapods.org

Add this to your podfile to add BFPaperTableViewCell to your project.

platform :ios, '7.0'
pod 'BFPaperTableViewCell', '~> 1.0.3'

License

BFPaperTableViewCell uses the MIT License:

Please see included LICENSE file.

bfpapertableviewcell's People

Contributors

bfeher avatar

Watchers

James Cloos avatar Mass avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.