Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
982c9e1b30 | ||
|
|
6956f385b3 | ||
|
|
4f641597d7 | ||
|
|
878a473b02 | ||
|
|
1ebd9b3e6f | ||
|
|
b7dc1f1d75 | ||
|
|
21e64f72c1 | ||
|
|
33dfe08a96 | ||
|
|
9d0982e62d | ||
|
|
b1b564e1e9 | ||
|
|
3ca2172098 | ||
|
|
9ea71b64eb | ||
|
|
306632b484 | ||
|
|
def7ad435b | ||
|
|
9db9073217 | ||
|
|
a5efd73115 | ||
|
|
882ef88655 | ||
|
|
216a62c6ab |
+1
-1
@@ -1,4 +1,4 @@
|
||||
osx_image: xcode7.2
|
||||
osx_image: xcode7.3
|
||||
language: objective-c
|
||||
|
||||
xcode_project: FoldingCell/FoldingCell.xcodeproj
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'FoldingCell'
|
||||
s.version = '0.6'
|
||||
s.version = '0.8.0'
|
||||
s.summary = 'UITableViewCell with folding animation.'
|
||||
s.homepage = 'https://github.com/Ramotion/folding-cell'
|
||||
s.license = 'MIT'
|
||||
|
||||
@@ -225,7 +225,7 @@
|
||||
TargetAttributes = {
|
||||
847A58031C294F750028FB84 = {
|
||||
CreatedOnToolsVersion = 7.2;
|
||||
DevelopmentTeam = 34MUF9YXTA;
|
||||
DevelopmentTeam = LEAZS7L33U;
|
||||
};
|
||||
8498513B1C5639F9006FA400 = {
|
||||
CreatedOnToolsVersion = 7.2;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="0cn-rv-Emg">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="0cn-rv-Emg">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
|
||||
</dependencies>
|
||||
<customFonts key="customFonts">
|
||||
<mutableArray key="OpenSans-Light.ttf">
|
||||
|
||||
@@ -21,8 +21,7 @@ class DemoCell: FoldingCell {
|
||||
|
||||
override func animationDuration(itemIndex:NSInteger, type:AnimationType)-> NSTimeInterval {
|
||||
|
||||
let durations = [0.33, 0.26, 0.26]
|
||||
|
||||
let durations = [0.26, 0.2, 0.2]
|
||||
return durations[itemIndex]
|
||||
}
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ public class FoldingCell: UITableViewCell {
|
||||
@IBOutlet weak public var foregroundView: RotatedView!
|
||||
var animationView: UIView?
|
||||
|
||||
@IBInspectable var itemCount: NSInteger = 2 //count of folding
|
||||
@IBInspectable public var itemCount: NSInteger = 2 //count of folding
|
||||
|
||||
@IBInspectable var backViewColor: UIColor = UIColor.brownColor()
|
||||
@IBInspectable public var backViewColor: UIColor = UIColor.brownColor()
|
||||
|
||||
var animationItemViews: [RotatedView]?
|
||||
|
||||
@@ -120,6 +120,7 @@ public class FoldingCell: UITableViewCell {
|
||||
}
|
||||
|
||||
func createAnimationView() {
|
||||
|
||||
let anAnimationView = UIView(frame: containerView.frame)
|
||||
anAnimationView.layer.cornerRadius = foregroundView.layer.cornerRadius
|
||||
anAnimationView.backgroundColor = UIColor.clearColor()
|
||||
@@ -154,9 +155,9 @@ public class FoldingCell: UITableViewCell {
|
||||
anAnimationView.addConstraint(newConstraint)
|
||||
}
|
||||
}
|
||||
|
||||
animationView = anAnimationView
|
||||
}
|
||||
|
||||
|
||||
func addImageItemsToAnimationView() {
|
||||
containerView.alpha = 1;
|
||||
@@ -195,7 +196,7 @@ public class FoldingCell: UITableViewCell {
|
||||
|
||||
var yPosition = 2 * forgSize.height
|
||||
var tag = 2
|
||||
for var index = 2; index < itemCount; index++ {
|
||||
for _ in 2..<itemCount {
|
||||
image = containerView.pb_takeSnapshot(CGRect(x: 0, y: yPosition, width: contSize.width, height: itemHeight))
|
||||
|
||||
imageView = UIImageView(image: image)
|
||||
@@ -209,7 +210,7 @@ public class FoldingCell: UITableViewCell {
|
||||
rotatedView.tag = tag
|
||||
|
||||
yPosition += itemHeight
|
||||
tag++;
|
||||
tag += 1;
|
||||
}
|
||||
|
||||
containerView.alpha = 0;
|
||||
@@ -226,6 +227,16 @@ public class FoldingCell: UITableViewCell {
|
||||
animationItemViews = createAnimationItemView()
|
||||
}
|
||||
|
||||
private func removeImageItemsFromAnimationView() {
|
||||
|
||||
guard let animationView = self.animationView else {
|
||||
return
|
||||
}
|
||||
|
||||
animationView.subviews.forEach({ $0.removeFromSuperview() })
|
||||
}
|
||||
|
||||
|
||||
// MARK: public
|
||||
|
||||
public func selectedAnimation(isSelected: Bool, animated: Bool, completion: CompletionHandler?) {
|
||||
@@ -278,7 +289,7 @@ public class FoldingCell: UITableViewCell {
|
||||
|
||||
func durationSequence(type: AnimationType)-> [NSTimeInterval] {
|
||||
var durations = [NSTimeInterval]()
|
||||
for var index = 0; index < itemCount-1; index++ {
|
||||
for index in 0..<itemCount-1 {
|
||||
let duration = animationDuration(index, type: .Open)
|
||||
durations.append(NSTimeInterval(duration / 2.0))
|
||||
durations.append(NSTimeInterval(duration / 2.0))
|
||||
@@ -288,9 +299,8 @@ public class FoldingCell: UITableViewCell {
|
||||
|
||||
func openAnimation(completion completion: CompletionHandler?) {
|
||||
|
||||
if animationView?.subviews.count == 0 { // added animation items if need
|
||||
addImageItemsToAnimationView()
|
||||
}
|
||||
removeImageItemsFromAnimationView()
|
||||
addImageItemsToAnimationView()
|
||||
|
||||
guard let animationView = self.animationView else {
|
||||
return
|
||||
@@ -312,7 +322,7 @@ public class FoldingCell: UITableViewCell {
|
||||
return
|
||||
}
|
||||
|
||||
for var index = 0; index < animationItemViews.count; index++ {
|
||||
for index in 0..<animationItemViews.count {
|
||||
let animatedView = animationItemViews[index]
|
||||
|
||||
animatedView.foldingAnimation(timing, from: from, to: to, duration: durations[index], delay: delay, hidden: hidden)
|
||||
@@ -341,8 +351,11 @@ public class FoldingCell: UITableViewCell {
|
||||
|
||||
func closeAnimation(completion completion: CompletionHandler?) {
|
||||
|
||||
if animationView?.subviews.count == 0 { // added animation items if need
|
||||
addImageItemsToAnimationView()
|
||||
removeImageItemsFromAnimationView()
|
||||
addImageItemsToAnimationView()
|
||||
|
||||
guard let animationItemViews = self.animationItemViews else {
|
||||
fatalError()
|
||||
}
|
||||
|
||||
animationView?.alpha = 1;
|
||||
@@ -356,11 +369,12 @@ public class FoldingCell: UITableViewCell {
|
||||
var to: CGFloat = CGFloat(M_PI / 2)
|
||||
var hidden = true
|
||||
configureAnimationItems(.Close)
|
||||
for var index = 0; index < animationItemViews?.count; index++ {
|
||||
|
||||
guard let animatedView = animationItemViews?.reverse()[index] else {
|
||||
continue
|
||||
}
|
||||
|
||||
if durations.count < animationItemViews.count {
|
||||
fatalError("wrong override func animationDuration(itemIndex:NSInteger, type:AnimationType)-> NSTimeInterval")
|
||||
}
|
||||
for index in 0..<animationItemViews.count {
|
||||
let animatedView = animationItemViews.reverse()[index]
|
||||
|
||||
animatedView.foldingAnimation(timing, from: from, to: to, duration: durations[index], delay: delay, hidden: hidden)
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ class MainTableViewController: UITableViewController {
|
||||
} else {// close cell
|
||||
cellHeights[indexPath.row] = kCloseCellHeight
|
||||
cell.selectedAnimation(false, animated: true, completion: nil)
|
||||
duration = 1.1
|
||||
duration = 0.8
|
||||
}
|
||||
|
||||
UIView.animateWithDuration(duration, delay: 0, options: .CurveEaseOut, animations: { () -> Void in
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||

|
||||
# FoldingCell
|
||||
[](https://cocoapods.org/pods/FoldingCell)
|
||||
[](http://cocoapods.org/pods/FoldingCell)
|
||||
@@ -8,6 +9,8 @@
|
||||
[shot on dribbble](https://dribbble.com/shots/2121350-Delivery-Card):
|
||||

|
||||
|
||||
|
||||
The [iPhone mockup](https://store.ramotion.com/product/iphone-6-mockups?utm_source=gthb&utm_medium=special&utm_campaign=folding-cell) available [here](https://store.ramotion.com/product/iphone-6-mockups?utm_source=gthb&utm_medium=special&utm_campaign=folding-cell).
|
||||
## Requirements
|
||||
|
||||
- iOS 8.0+
|
||||
@@ -19,7 +22,7 @@ Just add the FoldingCell.swift file to your project.
|
||||
|
||||
or use [CocoaPods](https://cocoapods.org) with Podfile:
|
||||
``` ruby
|
||||
pod 'FoldingCell', '~> 0.6'
|
||||
pod 'FoldingCell', '~> 0.7.3'
|
||||
```
|
||||
|
||||
|
||||
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
Reference in New Issue
Block a user