Giter VIP home page Giter VIP logo

materialcardview's Introduction

MaterialCardView

Create material design cards quick and easy

Demo

alt tag

Installation

Manuel

Copy & paste MaterialCardView.swift and CEMKit.swift to your project

CocoaPods

Add to your podfile

	pod 'MaterialCardView', '~> 0.0.2'

Usage

Create a MaterialCardView

	let c = MaterialCardView (
			       x: 10,
			       y: StatusBarHeight + 10,
			       w: ScreenWidth-20)  
	view.addSubview (c)

And start to add MaterialCardCells

  • Header Cell
	func addHeader (title: String)
	func addHeader (view: UIView)
  • Cell
	addCell (text: String, action: (()->Void)? = nil)
	addCell (view: UIView, action: (()->Void)? = nil)
	addCell (cell: MaterialCardCell)
  • FooterCell
	func addFooter (title: String)
	func addFooter (view: UIView)

Material Card will update its frame size when you add or remove MaterialCardCells.
This is why you don't set its height value when initilize it.

MaterialCardAppearance

	var headerBackgroundColor: UIColor
    var cellBackgroundColor: UIColor
    var borderColor: UIColor

    var titleFont: UIFont
    var titleColor: UIColor

    var textFont: UIFont
    var textColor: UIColor

    var shadowColor: UIColor
    var rippleColor: UIColor
    var rippleDuration: NSTimeInterval

You can change MaterialCardView appearance by its appearance property.

The default appearance is

    func defaultAppearance () -> MaterialCardAppearance {
        return MaterialCardAppearance (
            headerBackgroundColor: UIColor.CardHeaderColor(),
            cellBackgroundColor: UIColor.CardCellColor(),
            borderColor: UIColor.CardBorderColor(),
            titleFont: UIFont.TitleFont(),
            titleColor: UIColor.TitleColor(),
            textFont: UIFont.TextFont(),
            textColor: UIColor.TextColor(),
            shadowColor: UIColor.ShadowColor(),
            rippleColor: UIColor.RippleColor(),
            rippleDuration: rippleDuration)
    }

Which are UIColor and UIFont extensions defined at top of MaterialCardView.swift file.

MaterialAnimationTimingFunction

    enum MaterialAnimationTimingFunction {
        case SwiftEnterInOut
        case SwiftExitInOut

        func timingFunction () -> CAMediaTimingFunction {
            switch self {

            case .SwiftEnterInOut:
                return CAMediaTimingFunction (controlPoints: 0.4027, 0, 0.1, 1)

            case .SwiftExitInOut:
                return CAMediaTimingFunction (controlPoints: 0.4027, 0, 0.2256, 1)
            }
        }
    }

SwiftEnterInOut

(0.4027, 0, 0.1, 1)

SwiftExitInOut

(0.4027, 0, 0.2256, 1)

MaterialRippleLocation

enum MaterialRippleLocation {
    case Center
    case TouchLocation
}

RippleLayer

Adds ripple animation when you add cells with action
	c.addCell("Item 1") { sender in
		println("item 1 tapped")
	}

alt tag

Add ripple to material card
     c.addRipple { () -> Void in
       println("all card ripples")
   }

alt tag

materialcardview's People

Contributors

cemolcay avatar nathanwalker avatar orthographic-pedant avatar readmecritic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

materialcardview's Issues

swift 1.2

Hello,

i have tried today to run my project on the new xcode 6.3 beta with swift 1.2, but i have seen that your project isn´t compatible with this swift version. My question is when you want to adapt your project to swift 1.2.

Swift 2.0

Hello,

I'm using Xcode 7.0 Beta 2, your library and triggers many errors.
You're currently creating a branch to solve this problem?

Thanks.

Swift 2

Hello,

I sent my application using the card material to Apple Store and has been approved, but the download and run the same closes without reasons.

The problem does not occur in the simulator and in my development phone.

To reproduce the error you must generate a version of app.ipa on ad hock mode and install on your phone that the error occurs.

The error is in the method:
func defaultInit () {
h = 0
appeareance = defaultAppeareance()

    contentView = UIView(superView: self)
    addSubview(contentView)
}

I need help!!!
Thanks.

Add '+' Button To Header Cell?

Is there a way (feature request if it's not currently possible) to place a '+' or other icon in the header cell to add a new cell?

Autolayout support

Would it be possible to create a MaterialCardView instance without sizes (i.e. MaterialCardView() ), such that I can control the card size using Autolayout?

App generates 54 errors

Hello,

I downloaded your project as a zip and after running 'pod install' with the appropriate Podfile, Xcode gave me 54 errors. I do not believe that this is normal. I am running the latest version of Xcode.

screen shot 2016-02-22 at 11 53 16 am

screen shot 2016-02-22 at 11 54 01 am

Thanks!
Nick

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.