All Projects β†’ Ramotion β†’ Folding Cell

Ramotion / Folding Cell

Licence: mit
πŸ“ƒ FoldingCell is an expanding content cell with animation made by @Ramotion

Programming Languages

swift
15916 projects
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Folding Cell

Iconfontcppheaders
C, C++ headers and C# classes for icon fonts: Font Awesome, Fork Awesome, Material Design, Kenney game icons and Fontaudio
Stars: ✭ 509 (-94.93%)
Mutual labels:  library, material-design
Textfieldboxes
Material Design text field that comes in a box, based on (OLD) Google Material Design guidelines.
Stars: ✭ 760 (-92.43%)
Mutual labels:  library, material-design
Folding Cell Android
πŸ“ƒ FoldingCell is a material design expanding content cell inspired by folding paper material made by @Ramotion
Stars: ✭ 4,859 (-51.58%)
Mutual labels:  library, material-design
Google Material Icons For Sketch
Google Material Icons Library for Sketch App
Stars: ✭ 420 (-95.81%)
Mutual labels:  library, material-design
Simpledialogfragments
A collection of easy to use and extendable DialogFragment's for Android
Stars: ✭ 94 (-99.06%)
Mutual labels:  library, material-design
Candybar Library
Android icon pack material dashboard
Stars: ✭ 437 (-95.65%)
Mutual labels:  library, material-design
Stickyswitch
⭐️ beautiful switch widget with sticky animation ⭐️
Stars: ✭ 725 (-92.78%)
Mutual labels:  library, material-design
Framework7
Full featured HTML framework for building iOS & Android apps
Stars: ✭ 16,560 (+65.02%)
Mutual labels:  library, material-design
Wymaterialbutton
Interactive and fully animated Material Design button for iOS developers.
Stars: ✭ 80 (-99.2%)
Mutual labels:  library, material-design
Bottombar
(Deprecated) A custom view component that mimics the new Material Design Bottom Navigation pattern.
Stars: ✭ 8,459 (-15.71%)
Mutual labels:  library, material-design
Material Calendar View
πŸ“… Material Design Calendar compatible with API 11+
Stars: ✭ 360 (-96.41%)
Mutual labels:  library, material-design
Kivymd
Set of widgets for Kivy inspired by Google's Material Design.
Stars: ✭ 107 (-98.93%)
Mutual labels:  library, material-design
Aestheticdialogs
πŸ“± An Android Library for πŸ’«fluid, 😍beautiful, 🎨custom Dialogs.
Stars: ✭ 352 (-96.49%)
Mutual labels:  library, material-design
Circular Carousel
List a collection of items in a horizontally scrolling view. A scaling factor controls the size of the items relative to the center.
Stars: ✭ 493 (-95.09%)
Mutual labels:  library, material-design
Android Floatingtutorialactivity
A light-weight, easy-to-implement, and easy-to-look-at way to do a tutorial pager or dialog on Android
Stars: ✭ 346 (-96.55%)
Mutual labels:  library, material-design
Expanding Collection
ExpandingCollection is an animated material design UI card peek/pop controller. iOS library made by @Ramotion
Stars: ✭ 5,456 (-45.63%)
Mutual labels:  library, material-design
Wallpaperboard
Android Json based wallpaper dashboard library
Stars: ✭ 235 (-97.66%)
Mutual labels:  library, material-design
Materialchipsinput
Implementation of Material Design Chips component for Android
Stars: ✭ 2,605 (-74.04%)
Mutual labels:  library, material-design
Matter
Material Design Components in Pure CSS. Materializing HTML at just one class per component 🍰
Stars: ✭ 888 (-91.15%)
Mutual labels:  library, material-design
Bubble Navigation
πŸŽ‰ [Android Library] A light-weight library to easily make beautiful Navigation Bar with ton of 🎨 customization option.
Stars: ✭ 1,537 (-84.68%)
Mutual labels:  library, material-design

FOLDING CELL

Expanding content cell with animation inspired by folding paper card material design.


We specialize in the designing and coding of custom UI for Mobile Apps and Websites.

Stay tuned for the latest updates:


CocoaPods CocoaPods Twitter Travis codebeat badge Carthage compatible Swift 4.0 Analytics Donate

Requirements

  • iOS 8.0+
  • Xcode 10.2

Installation

Just add the FoldingCell.swift file to your project.

or use CocoaPods with Podfile:

pod 'FoldingCell'

or Carthage users can simply add Mantle to their Cartfile:

github "Ramotion/folding-cell"

or Swift Package Manager by adding:

dependencies: [
.package(url: "https://github.com/Ramotion/folding-cell.git", from: "5.0.2")
]

to Package.swift

or just drag and drop FoldingCell.swift file to your project

Solution

Solution

Usage

  1. Create a new cell inheriting from FoldingCell

  2. Add a UIView to your cell in your storyboard or nib file, inheriting from RotatedView. Connect the outlet from this view to the cell property foregroundView. Add constraints from this view to the superview, as in this picture:

1.1

(constants of constraints may be different). Connect the outlet from this top constraint to the cell property foregroundViewTop . (This view will be shown when the cell is in its normal state).

  1. Add other UIViews to your cell, connect the outlet from this view to the cell property containerView. Add constraints from this view to the superview like in the picture:

1.2

(constants of constraints may be different). Connect the outlet from this top constraint to the cell property containerViewTop. (This view will be shown when the cell is opened)

Your result should be something like this picture:

1.3

  1. Set @IBInspectable var itemCount: NSInteger property is a count of folding (it IBInspectable you can set in storyboard). range 2 or greater. Default value is 2

Ok, we've finished configuring the cell.

  1. Adding code to your UITableViewController

5.1) Add constants:

fileprivate struct C {
  struct CellHeight {
    static let close: CGFloat = *** // equal or greater foregroundView height
    static let open: CGFloat = *** // equal or greater containerView height
  }
}

5.2) Add property for calculate cells height

     var cellHeights = (0..<CELLCOUNT).map { _ in C.CellHeight.close }

5.3) Override method:

    override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        return cellHeights[indexPath.row]
    }

5.4) Added code to method:

    override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        guard case let cell as FoldingCell = tableView.cellForRowAtIndexPath(indexPath) else {
          return
        }

        var duration = 0.0
        if cellIsCollapsed {
            cellHeights[indexPath.row] = Const.openCellHeight
            cell.unfold(true, animated: true, completion: nil)
            duration = 0.5
        } else {
            cellHeights[indexPath.row] = Const.closeCellHeight
            cell.unfold(false, animated: true, completion: nil)
            duration = 0.8
        }

        UIView.animateWithDuration(duration, delay: 0, options: .CurveEaseOut, animations: { _ in
            tableView.beginUpdates()
            tableView.endUpdates()
        }, completion: nil)
    }

5.5) Control if the cell is open or closed

  override func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) {

        if case let cell as FoldingCell = cell {
            if cellHeights![indexPath.row] == C.cellHeights.close {
                foldingCell.selectedAnimation(false, animated: false, completion:nil)
            } else {
                foldingCell.selectedAnimation(true, animated: false, completion: nil)
            }
        }
    }
  1. Add this code to your new cell class
    override func animationDuration(itemIndex:NSInteger, type:AnimationType)-> NSTimeInterval {

        // durations count equal it itemCount
        let durations = [0.33, 0.26, 0.26] // timing animation for each view
        return durations[itemIndex]
    }

if don't use storyboard and xib files

Create foregroundView and containerView from code (steps 2 - 3) look example: Folding-cell-programmatically

πŸ—‚ Check this library on other language:

πŸ“„ License

Folding cell is released under the MIT license. See LICENSE for details.

This library is a part of a selection of our best UI open-source projects.

If you use the open-source library in your project, please make sure to credit and backlink to https://www.ramotion.com/

πŸ“± Get the Showroom App for iOS to give it a try

Try this UI component and more like this in our iOS app. Contact us if interested.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].