Compare commits

..
32 Commits
Author SHA1 Message Date
Alex K de2815310c code improve 2018-07-31 09:20:27 +03:00
Alex K 79ebfdad72 update podspec 2018-07-24 09:41:19 +03:00
Alex K 7fccf4465d increase deployment target 2018-07-24 09:39:25 +03:00
Alex K 10f2b4a593 Fixes #151 2018-07-17 11:22:06 +03:00
Alex K 2082c637fc update podspec 2018-07-11 14:19:27 +03:00
Alex K 1ad323db3e add constants for RotatedView 2018-07-11 14:16:40 +03:00
Alex K d0582c547e remove unused folders 2018-07-05 14:17:34 +03:00
Ramotion bab9a6cb13 Update README.md 2018-06-29 14:28:09 +03:00
Ramotion eb0fb13162 Update README.md 2018-06-26 10:03:34 +03:00
Alex K 28979e4c74 add mark 2018-06-19 14:07:28 +03:00
Alex K 9b169a7eeb rewrite constants in demo project 2018-06-13 09:20:05 +03:00
Ramotion e61613727f Update README.md 2018-06-05 09:11:16 +03:00
Ramotion b3c552e5e5 Update README.md 2018-05-29 11:52:45 +03:00
Ramotion acca9eeba7 Update README.md 2018-05-28 11:20:47 +03:00
Alex K 8c16530fbe code style improve 2018-05-21 10:09:39 +03:00
Alex K e4babdc1cc fix typo 2018-05-15 14:09:47 +03:00
Ramotion d2ebb37052 Update README.md 2018-05-09 10:24:56 +03:00
Alex K 8cfd463d24 add refresh control in demo project 2018-05-02 16:15:50 +03:00
Alex K 99d33faa5b update pod version 2018-05-02 16:05:23 +03:00
Alex K a4a918065d remove deprecated methods 2018-05-02 15:21:53 +03:00
Alex K dbaccb42b5 Merge branch 'master' of github.com:Ramotion/folding-cell 2018-05-02 15:15:43 +03:00
Alex K adbd6a608b Fixes #144 2018-05-02 15:15:34 +03:00
Ramotion f41fbfe98e Update README.md 2018-04-25 12:28:30 +03:00
Alex fd51a01d03 Update README.md 2018-04-23 09:26:46 +03:00
Ramotion 6f389b4850 Update README.md 2018-04-16 09:43:31 +03:00
Ramotion 9c1e834692 Update README.md 2018-04-09 09:44:30 +03:00
Ramotion da447982c8 Add files via upload 2018-04-09 09:43:35 +03:00
Alex K 816fe67543 update podspec 2018-04-02 10:21:06 +03:00
Alex K a191c4bc05 refactoring, remove guard with fatal error 2018-04-02 10:15:04 +03:00
Alex K cbe678277d update podspec 2018-03-27 16:37:34 +03:00
Alex K a760de74ee Fixes #126 make closeAnimation and opentAnimation methods public 2018-03-27 16:35:20 +03:00
Alex K 7d639d3332 update podspec 2018-03-27 16:32:23 +03:00
9 changed files with 102 additions and 77 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'FoldingCell'
s.version = '3.0.3'
s.version = '3.1.3'
s.summary = 'UITableViewCell with folding animation.'
s.homepage = 'https://github.com/Ramotion/folding-cell'
s.license = 'MIT'
@@ -26,9 +26,12 @@ import UIKit
class MainTableViewController: UITableViewController {
let kCloseCellHeight: CGFloat = 179
let kOpenCellHeight: CGFloat = 488
let kRowsCount = 10
enum Const {
static let closeCellHeight: CGFloat = 179
static let openCellHeight: CGFloat = 488
static let rowsCount = 10
}
var cellHeights: [CGFloat] = []
override func viewDidLoad() {
@@ -37,10 +40,24 @@ class MainTableViewController: UITableViewController {
}
private func setup() {
cellHeights = Array(repeating: kCloseCellHeight, count: kRowsCount)
tableView.estimatedRowHeight = kCloseCellHeight
cellHeights = Array(repeating: Const.closeCellHeight, count: Const.rowsCount)
tableView.estimatedRowHeight = Const.closeCellHeight
tableView.rowHeight = UITableViewAutomaticDimension
tableView.backgroundColor = UIColor(patternImage: #imageLiteral(resourceName: "background"))
if #available(iOS 10.0, *) {
tableView.refreshControl = UIRefreshControl()
tableView.refreshControl?.addTarget(self, action: #selector(refreshHandler), for: .valueChanged)
}
}
@objc func refreshHandler() {
let deadlineTime = DispatchTime.now() + .seconds(1)
DispatchQueue.main.asyncAfter(deadline: deadlineTime, execute: { [weak self] in
if #available(iOS 10.0, *) {
self?.tableView.refreshControl?.endRefreshing()
}
self?.tableView.reloadData()
})
}
}
@@ -59,7 +76,7 @@ extension MainTableViewController {
cell.backgroundColor = .clear
if cellHeights[indexPath.row] == kCloseCellHeight {
if cellHeights[indexPath.row] == Const.closeCellHeight {
cell.unfold(false, animated: false, completion: nil)
} else {
cell.unfold(true, animated: false, completion: nil)
@@ -89,13 +106,13 @@ extension MainTableViewController {
}
var duration = 0.0
let cellIsCollapsed = cellHeights[indexPath.row] == kCloseCellHeight
let cellIsCollapsed = cellHeights[indexPath.row] == Const.closeCellHeight
if cellIsCollapsed {
cellHeights[indexPath.row] = kOpenCellHeight
cellHeights[indexPath.row] = Const.openCellHeight
cell.unfold(true, animated: true, completion: nil)
duration = 0.5
} else {
cellHeights[indexPath.row] = kCloseCellHeight
cellHeights[indexPath.row] = Const.closeCellHeight
cell.unfold(false, animated: true, completion: nil)
duration = 0.8
}
@@ -59,9 +59,12 @@
NSNumber *height = [self.cellHeights objectAtIndex:indexPath.row];
bool cellIsCollapsed = height.floatValue == self.kCloseCellHeight;
if (cellIsCollapsed) {
[(FoldingCell *) cell selectedAnimation:false animated:false completion: nil];
[(FoldingCell *)cell unfold:NO animated:NO completion:nil];
//[(FoldingCell *) cell selectedAnimation:false animated:false completion: nil];
} else {
[(FoldingCell *) cell selectedAnimation:true animated:false completion: nil];
[(FoldingCell *)cell unfold:YES animated:NO completion:nil];
//[(FoldingCell *) cell selectedAnimation:true animated:false completion: nil];
}
UIView *backgroundTopView = [cell viewWithTag:11];
@@ -108,11 +111,13 @@
bool cellIsCollapsed = height.floatValue == self.kCloseCellHeight;
if (cellIsCollapsed) {
[self.cellHeights setObject:[NSNumber numberWithFloat:self.kOpenCellHeight] atIndexedSubscript:indexPath.row];
[cell selectedAnimation:true animated:true completion: nil];
//[cell selectedAnimation:true animated:true completion: nil];
[cell unfold:YES animated:YES completion:nil];
duration = 0.5;
} else {
[self.cellHeights setObject:[NSNumber numberWithFloat:self.kCloseCellHeight] atIndexedSubscript:indexPath.row];
[cell selectedAnimation:false animated:true completion: nil];
//[cell selectedAnimation:false animated:true completion: nil];
[cell unfold:NO animated:YES completion:nil];
duration = 0.8;
}
@@ -7,7 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
8498513F1C5639F9006FA400 /* FoldingCellTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8498513E1C5639F9006FA400 /* FoldingCellTests.swift */; };
8499D8881D0054A8004B5B37 /* FoldingCell.h in Headers */ = {isa = PBXBuildFile; fileRef = 8499D8871D0054A8004B5B37 /* FoldingCell.h */; settings = {ATTRIBUTES = (Public, ); }; };
9D57F31F1EDC7A6F0004599F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D57F31E1EDC7A6F0004599F /* AppDelegate.swift */; };
9D57F3241EDC7A6F0004599F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9D57F3221EDC7A6F0004599F /* Main.storyboard */; };
@@ -72,8 +71,6 @@
/* Begin PBXFileReference section */
8498513C1C5639F9006FA400 /* FoldingCellTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FoldingCellTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
8498513E1C5639F9006FA400 /* FoldingCellTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FoldingCellTests.swift; sourceTree = "<group>"; };
849851401C5639F9006FA400 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8499D8851D0054A8004B5B37 /* FoldingCell.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FoldingCell.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8499D8871D0054A8004B5B37 /* FoldingCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FoldingCell.h; sourceTree = "<group>"; };
8499D8891D0054A8004B5B37 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -136,7 +133,6 @@
isa = PBXGroup;
children = (
8499D8861D0054A8004B5B37 /* FoldingCell */,
8498513D1C5639F9006FA400 /* FoldingCellTests */,
9D57F31D1EDC7A6F0004599F /* FoldingCell-Demo */,
9DAA51551EDDBAD700DFC539 /* FoldingCell-DemoObjc */,
847A58051C294F750028FB84 /* Products */,
@@ -154,15 +150,6 @@
name = Products;
sourceTree = "<group>";
};
8498513D1C5639F9006FA400 /* FoldingCellTests */ = {
isa = PBXGroup;
children = (
8498513E1C5639F9006FA400 /* FoldingCellTests.swift */,
849851401C5639F9006FA400 /* Info.plist */,
);
path = FoldingCellTests;
sourceTree = "<group>";
};
8499D8861D0054A8004B5B37 /* FoldingCell */ = {
isa = PBXGroup;
children = (
@@ -305,7 +292,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0920;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "Alex K.";
TargetAttributes = {
8498513B1C5639F9006FA400 = {
@@ -395,7 +382,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8498513F1C5639F9006FA400 /* FoldingCellTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -490,12 +476,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -522,7 +510,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.4;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -542,12 +530,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -568,7 +558,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 11.4;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
@@ -37,7 +36,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
+34 -28
View File
@@ -26,7 +26,7 @@ import UIKit
/// UITableViewCell with folding animation
open class FoldingCell: UITableViewCell {
/// UIView whitch display when cell open
/// UIView is displayed when cell open
@IBOutlet open var containerView: UIView!
@IBOutlet open var containerViewTop: NSLayoutConstraint!
@@ -103,7 +103,8 @@ open class FoldingCell: UITableViewCell {
var rotatedViews = [RotatedView]()
animationView?.subviews
.flatMap({ $0 as? RotatedView })
.lazy
.compactMap({ $0 as? RotatedView })
.sorted(by: { $0.tag < $1.tag })
.forEach { itemView in
rotatedViews.append(itemView)
@@ -118,22 +119,20 @@ open class FoldingCell: UITableViewCell {
func configureAnimationItems(_ animationType: AnimationType) {
guard let animationViewSuperView = animationView?.subviews else {
fatalError()
}
if animationType == .open {
for view in animationViewSuperView.filter({ $0 is RotatedView }) {
view.alpha = 0
}
animationView?.subviews
.compactMap { $0 as? RotatedView }
.forEach { $0.alpha = 0 }
} else {
for case let view as RotatedView in animationViewSuperView.filter({ $0 is RotatedView }) {
if animationType == .open {
view.alpha = 0
} else {
view.alpha = 1
view.backView?.alpha = 0
}
animationView?.subviews
.compactMap { $0 as? RotatedView }
.forEach {
if animationType == .open {
$0.alpha = 0
} else {
$0.alpha = 1
$0.backView?.alpha = 0
}
}
}
}
@@ -185,14 +184,14 @@ open class FoldingCell: UITableViewCell {
let foregroundViewSize = foregroundView.bounds.size
// added first item
var image = containerView.pb_takeSnapshot(CGRect(x: 0, y: 0, width: containerViewSize.width, height: foregroundViewSize.height))
var image = containerView.takeSnapshot(CGRect(x: 0, y: 0, width: containerViewSize.width, height: foregroundViewSize.height))
var imageView = UIImageView(image: image)
imageView.tag = 0
imageView.layer.cornerRadius = foregroundView.layer.cornerRadius
animationView?.addSubview(imageView)
// added secod item
image = containerView.pb_takeSnapshot(CGRect(x: 0, y: foregroundViewSize.height, width: containerViewSize.width, height: foregroundViewSize.height))
image = containerView.takeSnapshot(CGRect(x: 0, y: foregroundViewSize.height, width: containerViewSize.width, height: foregroundViewSize.height))
imageView = UIImageView(image: image)
let rotatedView = RotatedView(frame: imageView.frame)
@@ -218,7 +217,7 @@ open class FoldingCell: UITableViewCell {
var yPosition = 2 * foregroundViewSize.height
var tag = 2
for _ in 2 ..< itemCount {
image = containerView.pb_takeSnapshot(CGRect(x: 0, y: yPosition, width: containerViewSize.width, height: itemHeight))
image = containerView.takeSnapshot(CGRect(x: 0, y: yPosition, width: containerViewSize.width, height: itemHeight))
imageView = UIImageView(image: image)
let rotatedView = RotatedView(frame: imageView.frame)
@@ -265,7 +264,7 @@ open class FoldingCell: UITableViewCell {
/// - value: unfold = true; collapse = false.
/// - animated: animate changes.
/// - completion: A block object to be executed when the animation sequence ends.
open func unfold(_ value: Bool, animated: Bool = true, completion: (() -> Void)? = nil) {
@objc open func unfold(_ value: Bool, animated: Bool = true, completion: (() -> Void)? = nil) {
if animated {
value ? openAnimation(completion) : closeAnimation(completion)
} else {
@@ -274,7 +273,7 @@ open class FoldingCell: UITableViewCell {
}
}
open func isAnimating() -> Bool {
@objc open func isAnimating() -> Bool {
return animationView?.alpha == 1 ? true : false
}
@@ -286,8 +285,8 @@ open class FoldingCell: UITableViewCell {
return type == .close ? durationsForCollapsedState[itemIndex] : durationsForExpandedState[itemIndex]
}
open var durationsForExpandedState: [TimeInterval] = []
open var durationsForCollapsedState: [TimeInterval] = []
@objc open var durationsForExpandedState: [TimeInterval] = []
@objc open var durationsForCollapsedState: [TimeInterval] = []
func durationSequence(_ type: AnimationType) -> [TimeInterval] {
var durations = [TimeInterval]()
@@ -299,7 +298,7 @@ open class FoldingCell: UITableViewCell {
return durations
}
func openAnimation(_ completion: (() -> Void)?) {
public func openAnimation(_ completion: (() -> Void)?) {
isUnfolded = true
removeImageItemsFromAnimationView()
addImageItemsToAnimationView()
@@ -346,7 +345,7 @@ open class FoldingCell: UITableViewCell {
}
}
func closeAnimation(_ completion: (() -> Void)?) {
public func closeAnimation(_ completion: (() -> Void)?) {
isUnfolded = false
removeImageItemsFromAnimationView()
addImageItemsToAnimationView()
@@ -402,6 +401,12 @@ open class FoldingCell: UITableViewCell {
// MARK: RotatedView
open class RotatedView: UIView {
fileprivate enum Const {
static let rotationX = "rotation.x"
static let transformRotationX = "transform.rotation.x"
}
var hiddenAfterAnimation = false
var backView: RotatedView?
@@ -448,7 +453,7 @@ extension RotatedView: CAAnimationDelegate {
func foldingAnimation(_ timing: String, from: CGFloat, to: CGFloat, duration: TimeInterval, delay: TimeInterval, hidden: Bool) {
let rotateAnimation = CABasicAnimation(keyPath: "transform.rotation.x")
let rotateAnimation = CABasicAnimation(keyPath: Const.transformRotationX)
rotateAnimation.timingFunction = CAMediaTimingFunction(name: timing)
rotateAnimation.fromValue = from
rotateAnimation.toValue = to
@@ -460,7 +465,7 @@ extension RotatedView: CAAnimationDelegate {
self.hiddenAfterAnimation = hidden
self.layer.add(rotateAnimation, forKey: "rotation.x")
self.layer.add(rotateAnimation, forKey: Const.rotationX)
}
public func animationDidStart(_: CAAnimation) {
@@ -478,9 +483,10 @@ extension RotatedView: CAAnimationDelegate {
}
}
// MARK: UIView + extension
private extension UIView {
func pb_takeSnapshot(_ frame: CGRect) -> UIImage? {
func takeSnapshot(_ frame: CGRect) -> UIImage? {
UIGraphicsBeginImageContextWithOptions(frame.size, false, 0)
guard let context = UIGraphicsGetCurrentContext() else { return nil }
+16 -15
View File
@@ -1,5 +1,6 @@
![header](./header.png)
![Animation](./Screenshots/folding-cell.gif)
<img src="https://github.com/Ramotion/folding-cell/blob/master/Screenshots/foldingCell.gif" width="600" height="450" /></a>
<br><br/>
# FoldingCell
[![CocoaPods](https://img.shields.io/cocoapods/p/FoldingCell.svg)](https://cocoapods.org/pods/FoldingCell)
@@ -10,19 +11,20 @@
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Swift 4.0](https://img.shields.io/badge/Swift-4.0-green.svg?style=flat)](https://developer.apple.com/swift/)
[![Analytics](https://ga-beacon.appspot.com/UA-84973210-1/ramotion/folding-cell)](https://github.com/igrigorik/ga-beacon)
[![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://paypal.me/Ramotion)
# Check this library on other platforms:
<a href="https://github.com/Ramotion/folding-cell-android">
<a href="https://github.com/Ramotion/folding-cell-android">
<img src="https://github.com/ramotion/navigation-stack/raw/master/Android_Java@2x.png" width="178" height="81"></a>
**Looking for developers for your project?**<br>
This project is maintained by Ramotion, Inc. We specialize in the designing and coding of custom UI for Mobile Apps and Websites.
<a href="https://dev.ramotion.com/?utm_source=gthb&utm_medium=special&utm_campaign=folding-cell-contact-us">
<a href="mailto:alex.a@ramotion.com?subject=Project%20inquiry%20from%20Github">
<img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a> <br>
The [iPhone mockup](https://store.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=folding-cell) available [here](https://store.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=folding-cell).
The [iPhone mockup](https://store.ramotion.com/product/iphone-x-clay-mockups?utm_source=gthb&utm_medium=special&utm_campaign=folding-cell) available [here](https://store.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=folding-cell).
## Requirements
@@ -72,7 +74,6 @@ Your result should be something like this picture:
![1.3](https://raw.githubusercontent.com/Ramotion/folding-cell/master/Tutorial-resources/1.3.png)
[Demonstration adding constraints for foregroundView, containerView](https://vimeo.com/154954299)
4) 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
@@ -110,14 +111,14 @@ fileprivate struct C {
}
var duration = 0.0
if cellHeights[indexPath.row] == kCloseCellHeight { // open cell
cellHeights[indexPath.row] = kOpenCellHeight
cell.selectedAnimation(true, animated: true, completion: nil)
if cellIsCollapsed {
cellHeights[indexPath.row] = Const.openCellHeight
cell.unfold(true, animated: true, completion: nil)
duration = 0.5
} else {// close cell
cellHeights[indexPath.row] = kCloseCellHeight
cell.selectedAnimation(false, animated: true, completion: nil)
duration = 1.1
} 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
@@ -160,7 +161,7 @@ Create foregroundView and containerView from code (steps 2 - 3) look example:
Folding cell is released under the MIT license.
See [LICENSE](./LICENSE) for details.
<br>
This library is a part of a <a href="https://github.com/Ramotion/swift-ui-animation-components-and-libraries"><b>selection of our best UI open-source projects.</b></a>
# 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.
@@ -168,11 +169,11 @@ Try this UI component and more like this in our iOS app. Contact us if intereste
<a href="https://itunes.apple.com/app/apple-store/id1182360240?pt=550053&ct=folding-cell&mt=8" >
<img src="https://github.com/ramotion/gliding-collection/raw/master/app_store@2x.png" width="117" height="34"></a>
<a href="https://dev.ramotion.com/?utm_source=gthb&utm_medium=special&utm_campaign=folding-cell-contact-us">
<a href="mailto:alex.a@ramotion.com?subject=Project%20inquiry%20from%20Github">
<img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a>
<br>
<br>
Follow us for the latest updates<br>
## Follow us for the latest update<br>
<a href="https://goo.gl/rPFpid" >
<img src="https://i.imgur.com/ziSqeSo.png/" width="156" height="28"></a>
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 MiB