Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2285009361 | ||
|
|
f6d649a79c | ||
|
|
2bc6905e3a | ||
|
|
f279359721 | ||
|
|
859a868aa4 | ||
|
|
c9c516dc19 | ||
|
|
3335c26e78 | ||
|
|
27d2bc7a62 | ||
|
|
882a279d56 | ||
|
|
959c31e2c5 | ||
|
|
8777fc4410 | ||
|
|
27b748230b | ||
|
|
f887081e42 | ||
|
|
370b3dae99 | ||
|
|
d6e2b6cebb | ||
|
|
a102990f70 | ||
|
|
78f726da6b | ||
|
|
de2815310c | ||
|
|
79ebfdad72 | ||
|
|
7fccf4465d | ||
|
|
10f2b4a593 | ||
|
|
2082c637fc | ||
|
|
1ad323db3e | ||
|
|
d0582c547e | ||
|
|
bab9a6cb13 | ||
|
|
eb0fb13162 | ||
|
|
28979e4c74 | ||
|
|
9b169a7eeb | ||
|
|
e61613727f | ||
|
|
b3c552e5e5 | ||
|
|
acca9eeba7 | ||
|
|
8c16530fbe | ||
|
|
e4babdc1cc | ||
|
|
d2ebb37052 | ||
|
|
8cfd463d24 | ||
|
|
99d33faa5b | ||
|
|
a4a918065d | ||
|
|
dbaccb42b5 | ||
|
|
adbd6a608b | ||
|
|
f41fbfe98e | ||
|
|
fd51a01d03 | ||
|
|
6f389b4850 | ||
|
|
9c1e834692 | ||
|
|
da447982c8 | ||
|
|
816fe67543 | ||
|
|
a191c4bc05 | ||
|
|
cbe678277d | ||
|
|
a760de74ee | ||
|
|
7d639d3332 | ||
|
|
dc52176452 | ||
|
|
259e726146 | ||
|
|
381fe89df9 | ||
|
|
99d7b642c9 | ||
|
|
d5aa310bd6 | ||
|
|
df05fb3424 | ||
|
|
f144e16433 | ||
|
|
c9c710f485 | ||
|
|
49611acdf9 | ||
|
|
283afd04b2 | ||
|
|
7cf93be5b7 | ||
|
|
ae01474fa4 | ||
|
|
16fa9ad54d | ||
|
|
40d58abd2b | ||
|
|
09c886e9a2 | ||
|
|
814030c8cb | ||
|
|
fd985711a6 | ||
|
|
f48738aeda | ||
|
|
da2a94c3be | ||
|
|
ecac481f39 | ||
|
|
f4a5de56d1 | ||
|
|
04a06c69cc | ||
|
|
2809a7ae44 | ||
|
|
d9d86e1bbf | ||
|
|
5e5639f5d0 | ||
|
|
02d5d8431d | ||
|
|
1d20e0bd06 | ||
|
|
4be8ef9b1d |
@@ -0,0 +1 @@
|
||||
4.2
|
||||
+11
-12
@@ -1,14 +1,13 @@
|
||||
osx_image: xcode8
|
||||
osx_image: xcode9.2
|
||||
language: objective-c
|
||||
|
||||
env:
|
||||
- DESTINATION="OS=10.0,name=iPhone 6s" SCHEME="FoldingCell" SDK=iphonesimulator10.0
|
||||
before_install:
|
||||
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
|
||||
script:
|
||||
- set -o pipefail
|
||||
- xcodebuild -version
|
||||
- xcodebuild -project FoldingCell/FoldingCell.xcodeproj -scheme "FoldingCell" -sdk "$SDK" -destination "$DESTINATION"
|
||||
-configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty -c
|
||||
- xcodebuild -project FoldingCell/FoldingCell.xcodeproj -scheme "FoldingCell" -sdk "$SDK" -destination "$DESTINATION"
|
||||
-configuration Release ONLY_ACTIVE_ARCH=NO build | xcpretty -c
|
||||
xcode_project: FoldingCell/FoldingCell.xcodeproj
|
||||
xcode_scheme: FoldingCell
|
||||
xcode_sdk: iphonesimulator11.2
|
||||
|
||||
# SWIFT_VERSION: 4.0
|
||||
|
||||
# whitelist
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'FoldingCell'
|
||||
s.version = '2.1.3'
|
||||
s.version = '4.0.1'
|
||||
s.summary = 'UITableViewCell with folding animation.'
|
||||
s.homepage = 'https://github.com/Ramotion/folding-cell'
|
||||
s.license = 'MIT'
|
||||
|
||||
@@ -25,22 +25,10 @@ import UIKit
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func applicationWillResignActive(_ application: UIApplication) { }
|
||||
|
||||
func applicationDidEnterBackground(_ application: UIApplication) { }
|
||||
|
||||
func applicationWillEnterForeground(_ application: UIApplication) { }
|
||||
|
||||
func applicationDidBecomeActive(_ application: UIApplication) { }
|
||||
|
||||
func applicationWillTerminate(_ application: UIApplication) { }
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,11 @@
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "ios-marketing",
|
||||
"size" : "1024x1024",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11198.2" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
@@ -17,12 +21,33 @@
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2018 Ramotion. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fcf-sN-ku0">
|
||||
<rect key="frame" x="16" y="630" width="343" height="17"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Folding Cell" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bCd-3b-lHA">
|
||||
<rect key="frame" x="139.5" y="323" width="96" height="21"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="fcf-sN-ku0" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leadingMargin" id="811-hI-Egq"/>
|
||||
<constraint firstItem="bCd-3b-lHA" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="T4x-O3-JqD"/>
|
||||
<constraint firstItem="bCd-3b-lHA" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="VFr-tp-sPw"/>
|
||||
<constraint firstItem="fcf-sN-ku0" firstAttribute="trailing" secondItem="Ze5-6b-2t3" secondAttribute="trailingMargin" id="dS9-pv-ebe"/>
|
||||
<constraint firstItem="xb3-aO-Qok" firstAttribute="top" secondItem="fcf-sN-ku0" secondAttribute="bottom" constant="20" id="kbD-dX-t3N"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
<point key="canvasLocation" x="52" y="374.66266866566718"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="0cn-rv-Emg">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="0cn-rv-Emg">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<customFonts key="customFonts">
|
||||
@@ -25,7 +25,7 @@
|
||||
<objects>
|
||||
<tableViewController storyboardIdentifier="MainTableViewController" id="0cn-rv-Emg" customClass="MainTableViewController" customModule="FoldingCell_Demo" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="667" sectionHeaderHeight="28" sectionFooterHeight="28" id="MwZ-K3-six">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="695"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="708"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<color key="sectionIndexBackgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
@@ -66,11 +66,13 @@
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="88" id="79O-5u-rWy"/>
|
||||
<constraint firstItem="uWG-zH-Vjo" firstAttribute="centerY" secondItem="UhV-pr-kw4" secondAttribute="centerY" constant="-35" id="BKr-4U-Xpn"/>
|
||||
<constraint firstItem="9ka-ho-kkM" firstAttribute="leading" secondItem="UhV-pr-kw4" secondAttribute="leading" constant="18" id="Cay-aa-P2d"/>
|
||||
<constraint firstItem="9ka-ho-kkM" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="UhV-pr-kw4" secondAttribute="leading" id="Cay-aa-P2d"/>
|
||||
<constraint firstItem="uWG-zH-Vjo" firstAttribute="centerX" secondItem="UhV-pr-kw4" secondAttribute="centerX" constant="-4" id="JBk-n5-unF"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="FQM-r1-a67" secondAttribute="trailing" constant="20" symbolic="YES" id="YfX-oc-QrI"/>
|
||||
<constraint firstAttribute="bottom" secondItem="9ka-ho-kkM" secondAttribute="bottom" constant="28" id="bej-dB-MVA"/>
|
||||
<constraint firstItem="FQM-r1-a67" firstAttribute="leading" secondItem="UhV-pr-kw4" secondAttribute="leading" constant="18" id="c48-WJ-cDt"/>
|
||||
<constraint firstAttribute="bottom" secondItem="FQM-r1-a67" secondAttribute="bottom" constant="50" id="ccu-aB-Y5n"/>
|
||||
<constraint firstAttribute="trailing" secondItem="9ka-ho-kkM" secondAttribute="trailing" constant="14" id="yC5-K2-pLt"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="dots" translatesAutoresizingMaskIntoConstraints="NO" id="lOX-iD-3OO">
|
||||
@@ -88,13 +90,13 @@
|
||||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="W 85th St, New York, 10024 " lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="7" translatesAutoresizingMaskIntoConstraints="NO" id="BUL-Of-nxF" userLabel="W 85th St, New York, 10024">
|
||||
<rect key="frame" x="124" y="28" width="426" height="16.5"/>
|
||||
<rect key="frame" x="370" y="28" width="180" height="16.5"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="14"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.23921568627450979" blue="0.2627450980392157" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="E 30th St, New York, 10016" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="7" translatesAutoresizingMaskIntoConstraints="NO" id="mNy-cH-kEi" userLabel="W 85th St, New York, 10024">
|
||||
<rect key="frame" x="124" y="57" width="426" height="16.5"/>
|
||||
<rect key="frame" x="378" y="57" width="172" height="16.5"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="14"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.23921568630000001" blue="0.26274509800000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -119,7 +121,9 @@
|
||||
<constraints>
|
||||
<constraint firstItem="fZc-Gv-4xg" firstAttribute="leading" secondItem="LnD-j0-rqc" secondAttribute="leading" id="L6e-Uv-9vS"/>
|
||||
<constraint firstAttribute="bottom" secondItem="fZc-Gv-4xg" secondAttribute="bottom" id="ZRs-x2-A0s"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="fZc-Gv-4xg" secondAttribute="trailing" constant="20" symbolic="YES" id="jo5-im-pgZ"/>
|
||||
<constraint firstItem="dKi-6r-6NP" firstAttribute="leading" secondItem="LnD-j0-rqc" secondAttribute="leading" id="oWr-Zs-xYW"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="dKi-6r-6NP" secondAttribute="trailing" constant="20" symbolic="YES" id="rtR-Zg-NTk"/>
|
||||
<constraint firstItem="dKi-6r-6NP" firstAttribute="top" secondItem="LnD-j0-rqc" secondAttribute="top" id="wF5-DY-L1I"/>
|
||||
</constraints>
|
||||
</view>
|
||||
@@ -143,8 +147,10 @@
|
||||
<constraints>
|
||||
<constraint firstItem="O5e-nR-iJW" firstAttribute="leading" secondItem="edX-4x-TiO" secondAttribute="leading" id="AYj-MP-1rV"/>
|
||||
<constraint firstItem="O5e-nR-iJW" firstAttribute="top" secondItem="edX-4x-TiO" secondAttribute="top" id="cgQ-TI-IsS"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="a0P-Eh-vI9" secondAttribute="trailing" constant="20" symbolic="YES" id="ltE-8P-eIm"/>
|
||||
<constraint firstItem="a0P-Eh-vI9" firstAttribute="leading" secondItem="edX-4x-TiO" secondAttribute="leading" id="oTf-nY-JXI"/>
|
||||
<constraint firstAttribute="bottom" secondItem="a0P-Eh-vI9" secondAttribute="bottom" id="oeJ-q1-9t1"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="O5e-nR-iJW" secondAttribute="trailing" constant="20" symbolic="YES" id="uwS-Um-Dzp"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="XAj-wA-vfn" userLabel="LeftVoew">
|
||||
@@ -169,6 +175,8 @@
|
||||
<constraint firstAttribute="bottom" secondItem="sA6-bX-nDC" secondAttribute="bottom" id="FLY-M3-HBk"/>
|
||||
<constraint firstAttribute="height" constant="40" id="JEm-kR-Yum"/>
|
||||
<constraint firstItem="X8Y-jq-qbv" firstAttribute="leading" secondItem="XAj-wA-vfn" secondAttribute="leading" id="bpa-pP-9bM"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="X8Y-jq-qbv" secondAttribute="trailing" constant="20" symbolic="YES" id="gFa-fO-TAV"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="sA6-bX-nDC" secondAttribute="trailing" constant="20" symbolic="YES" id="pCm-UL-opC"/>
|
||||
<constraint firstItem="X8Y-jq-qbv" firstAttribute="top" secondItem="XAj-wA-vfn" secondAttribute="top" id="qjl-VM-Pwi"/>
|
||||
</constraints>
|
||||
</view>
|
||||
@@ -177,7 +185,7 @@
|
||||
<constraints>
|
||||
<constraint firstItem="LnD-j0-rqc" firstAttribute="centerY" secondItem="XAj-wA-vfn" secondAttribute="centerY" id="1WA-KY-kPA"/>
|
||||
<constraint firstAttribute="trailing" secondItem="LnD-j0-rqc" secondAttribute="trailing" id="23p-a2-A6L"/>
|
||||
<constraint firstItem="BUL-Of-nxF" firstAttribute="leading" secondItem="CQr-i9-7br" secondAttribute="leading" constant="124" id="4Aj-wM-xak"/>
|
||||
<constraint firstItem="BUL-Of-nxF" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="CQr-i9-7br" secondAttribute="leading" id="4Aj-wM-xak"/>
|
||||
<constraint firstItem="XAj-wA-vfn" firstAttribute="width" secondItem="edX-4x-TiO" secondAttribute="width" id="4SA-da-3ek"/>
|
||||
<constraint firstItem="lOX-iD-3OO" firstAttribute="top" secondItem="CQr-i9-7br" secondAttribute="top" constant="32" id="Dgd-LY-uFx"/>
|
||||
<constraint firstItem="UhV-pr-kw4" firstAttribute="leading" secondItem="CQr-i9-7br" secondAttribute="leading" id="HeC-4J-km5"/>
|
||||
@@ -186,7 +194,7 @@
|
||||
<constraint firstAttribute="trailing" secondItem="mNy-cH-kEi" secondAttribute="trailing" constant="10" id="Rqh-At-NpG"/>
|
||||
<constraint firstItem="XAj-wA-vfn" firstAttribute="leading" secondItem="UhV-pr-kw4" secondAttribute="trailing" constant="20" id="TBj-Xh-aIR"/>
|
||||
<constraint firstItem="UhV-pr-kw4" firstAttribute="top" secondItem="CQr-i9-7br" secondAttribute="top" id="V89-lD-fHB"/>
|
||||
<constraint firstItem="mNy-cH-kEi" firstAttribute="leading" secondItem="CQr-i9-7br" secondAttribute="leading" constant="124" id="XMf-Cs-Nu8"/>
|
||||
<constraint firstItem="mNy-cH-kEi" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="CQr-i9-7br" secondAttribute="leading" id="XMf-Cs-Nu8"/>
|
||||
<constraint firstItem="EVE-fe-u5I" firstAttribute="top" secondItem="CQr-i9-7br" secondAttribute="top" constant="52" id="Z3h-Dn-3CO"/>
|
||||
<constraint firstItem="LnD-j0-rqc" firstAttribute="height" secondItem="XAj-wA-vfn" secondAttribute="height" id="anH-lP-Xab"/>
|
||||
<constraint firstAttribute="height" constant="165" id="bfl-Uq-i0I"/>
|
||||
@@ -237,6 +245,7 @@
|
||||
<constraint firstAttribute="height" constant="49" id="AC3-t0-KIM"/>
|
||||
<constraint firstAttribute="trailing" secondItem="4ve-4H-KPK" secondAttribute="trailing" constant="12" id="BgX-bA-WJy"/>
|
||||
<constraint firstItem="4ve-4H-KPK" firstAttribute="top" secondItem="o36-zd-BZb" secondAttribute="top" id="RwT-Kf-gV5"/>
|
||||
<constraint firstItem="4ve-4H-KPK" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="o36-zd-BZb" secondAttribute="leading" constant="20" symbolic="YES" id="bcC-Jw-xQO"/>
|
||||
<constraint firstItem="vW5-Q1-KFs" firstAttribute="leading" secondItem="o36-zd-BZb" secondAttribute="leading" constant="14" id="eOn-QU-u2B"/>
|
||||
<constraint firstAttribute="bottom" secondItem="4ve-4H-KPK" secondAttribute="bottom" id="n0y-uI-DZL"/>
|
||||
<constraint firstAttribute="trailing" secondItem="7eb-NE-XLS" secondAttribute="trailing" id="ncs-Bz-WO7"/>
|
||||
@@ -270,7 +279,9 @@
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="qOA-jB-5OO" secondAttribute="trailing" constant="20" symbolic="YES" id="3fn-95-aAz"/>
|
||||
<constraint firstItem="qOA-jB-5OO" firstAttribute="top" secondItem="sdL-VL-QmS" secondAttribute="top" id="cGd-ZP-J1s"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="S4b-sI-0J6" secondAttribute="trailing" constant="20" symbolic="YES" id="hFA-F9-nvT"/>
|
||||
<constraint firstItem="S4b-sI-0J6" firstAttribute="leading" secondItem="sdL-VL-QmS" secondAttribute="leading" id="j7G-um-lhR"/>
|
||||
<constraint firstItem="qOA-jB-5OO" firstAttribute="leading" secondItem="sdL-VL-QmS" secondAttribute="leading" id="kbc-V1-6VS"/>
|
||||
<constraint firstAttribute="height" constant="40" id="nCu-JM-dqc"/>
|
||||
@@ -320,8 +331,10 @@
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="R9w-bP-fWa" secondAttribute="trailing" id="03y-gy-i1D"/>
|
||||
<constraint firstItem="8pV-vb-qIN" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="LnF-7u-0Wm" secondAttribute="leading" constant="20" symbolic="YES" id="5v9-wv-MiA"/>
|
||||
<constraint firstAttribute="trailing" secondItem="8pV-vb-qIN" secondAttribute="trailing" id="C3p-9o-b86"/>
|
||||
<constraint firstItem="8pV-vb-qIN" firstAttribute="top" secondItem="LnF-7u-0Wm" secondAttribute="top" id="P9u-kS-VVp"/>
|
||||
<constraint firstItem="R9w-bP-fWa" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="LnF-7u-0Wm" secondAttribute="leading" constant="20" symbolic="YES" id="Y6C-17-VcW"/>
|
||||
<constraint firstAttribute="bottom" secondItem="R9w-bP-fWa" secondAttribute="bottom" id="g99-zI-5d7"/>
|
||||
</constraints>
|
||||
</view>
|
||||
@@ -489,6 +502,7 @@
|
||||
<constraint firstItem="h39-gf-gsn" firstAttribute="leading" secondItem="lbp-KK-0lW" secondAttribute="trailing" constant="1" id="pXq-um-J27"/>
|
||||
<constraint firstAttribute="trailing" secondItem="dff-zA-mGx" secondAttribute="trailing" id="rP4-SC-s3a"/>
|
||||
<constraint firstAttribute="trailing" secondItem="fuy-ww-tkB" secondAttribute="trailing" constant="22" id="trm-Sb-BDX"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="W63-7b-X8w" secondAttribute="trailing" constant="20" symbolic="YES" id="u1C-hG-9rE"/>
|
||||
<constraint firstAttribute="height" constant="165" id="zna-xw-SZ3"/>
|
||||
</constraints>
|
||||
</view>
|
||||
@@ -680,7 +694,7 @@
|
||||
</connections>
|
||||
</tableView>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<size key="freeformSize" width="600" height="695"/>
|
||||
<size key="freeformSize" width="600" height="708"/>
|
||||
</tableViewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="WxO-6i-Q9B" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
|
||||
@@ -6,39 +6,38 @@
|
||||
// Copyright © 2015 Alex K. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import FoldingCell
|
||||
import UIKit
|
||||
|
||||
class DemoCell: FoldingCell {
|
||||
|
||||
@IBOutlet weak var closeNumberLabel: UILabel!
|
||||
@IBOutlet weak var openNumberLabel: UILabel!
|
||||
|
||||
var number: Int = 0 {
|
||||
didSet {
|
||||
closeNumberLabel.text = String(number)
|
||||
openNumberLabel.text = String(number)
|
||||
|
||||
@IBOutlet var closeNumberLabel: UILabel!
|
||||
@IBOutlet var openNumberLabel: UILabel!
|
||||
|
||||
var number: Int = 0 {
|
||||
didSet {
|
||||
closeNumberLabel.text = String(number)
|
||||
openNumberLabel.text = String(number)
|
||||
}
|
||||
}
|
||||
|
||||
override func awakeFromNib() {
|
||||
foregroundView.layer.cornerRadius = 10
|
||||
foregroundView.layer.masksToBounds = true
|
||||
super.awakeFromNib()
|
||||
}
|
||||
|
||||
override func animationDuration(_ itemIndex: NSInteger, type _: FoldingCell.AnimationType) -> TimeInterval {
|
||||
let durations = [0.26, 0.2, 0.2]
|
||||
return durations[itemIndex]
|
||||
}
|
||||
}
|
||||
|
||||
override func awakeFromNib() {
|
||||
foregroundView.layer.cornerRadius = 10
|
||||
foregroundView.layer.masksToBounds = true
|
||||
super.awakeFromNib()
|
||||
}
|
||||
|
||||
override func animationDuration(_ itemIndex: NSInteger, type: FoldingCell.AnimationType) -> TimeInterval {
|
||||
let durations = [0.26, 0.2, 0.2]
|
||||
return durations[itemIndex]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Actions ⚡️
|
||||
|
||||
extension DemoCell {
|
||||
|
||||
@IBAction func buttonHandler(_ sender: AnyObject) {
|
||||
print("tap")
|
||||
}
|
||||
|
||||
|
||||
@IBAction func buttonHandler(_: AnyObject) {
|
||||
print("tap")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,90 +21,105 @@
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
|
||||
import UIKit
|
||||
import FoldingCell
|
||||
import UIKit
|
||||
|
||||
class MainTableViewController: UITableViewController {
|
||||
|
||||
let kCloseCellHeight: CGFloat = 179
|
||||
let kOpenCellHeight: CGFloat = 488
|
||||
let kRowsCount = 10
|
||||
var cellHeights: [CGFloat] = []
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
setup()
|
||||
}
|
||||
|
||||
private func setup() {
|
||||
cellHeights = Array(repeating: kCloseCellHeight, count: kRowsCount)
|
||||
tableView.estimatedRowHeight = kCloseCellHeight
|
||||
tableView.rowHeight = UITableViewAutomaticDimension
|
||||
tableView.backgroundColor = UIColor(patternImage: #imageLiteral(resourceName: "background"))
|
||||
}
|
||||
|
||||
|
||||
enum Const {
|
||||
static let closeCellHeight: CGFloat = 179
|
||||
static let openCellHeight: CGFloat = 488
|
||||
static let rowsCount = 10
|
||||
}
|
||||
|
||||
var cellHeights: [CGFloat] = []
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
setup()
|
||||
}
|
||||
|
||||
private func setup() {
|
||||
cellHeights = Array(repeating: Const.closeCellHeight, count: Const.rowsCount)
|
||||
tableView.estimatedRowHeight = Const.closeCellHeight
|
||||
tableView.rowHeight = UITableView.automaticDimension
|
||||
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()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - TableView
|
||||
|
||||
extension MainTableViewController {
|
||||
|
||||
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return 10
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
|
||||
guard case let cell as DemoCell = cell else {
|
||||
return
|
||||
|
||||
override func tableView(_: UITableView, numberOfRowsInSection _: Int) -> Int {
|
||||
return 10
|
||||
}
|
||||
|
||||
cell.backgroundColor = .clear
|
||||
|
||||
if cellHeights[indexPath.row] == kCloseCellHeight {
|
||||
cell.selectedAnimation(false, animated: false, completion:nil)
|
||||
} else {
|
||||
cell.selectedAnimation(true, animated: false, completion: nil)
|
||||
|
||||
override func tableView(_: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
|
||||
guard case let cell as DemoCell = cell else {
|
||||
return
|
||||
}
|
||||
|
||||
cell.backgroundColor = .clear
|
||||
|
||||
if cellHeights[indexPath.row] == Const.closeCellHeight {
|
||||
cell.unfold(false, animated: false, completion: nil)
|
||||
} else {
|
||||
cell.unfold(true, animated: false, completion: nil)
|
||||
}
|
||||
|
||||
cell.number = indexPath.row
|
||||
}
|
||||
|
||||
cell.number = indexPath.row
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: "FoldingCell", for: indexPath) as! FoldingCell
|
||||
let durations: [TimeInterval] = [0.26, 0.2, 0.2]
|
||||
cell.durationsForExpandedState = durations
|
||||
cell.durationsForCollapsedState = durations
|
||||
return cell
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
||||
return cellHeights[indexPath.row]
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
|
||||
let cell = tableView.cellForRow(at: indexPath) as! FoldingCell
|
||||
|
||||
if cell.isAnimating() {
|
||||
return
|
||||
|
||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: "FoldingCell", for: indexPath) as! FoldingCell
|
||||
let durations: [TimeInterval] = [0.26, 0.2, 0.2]
|
||||
cell.durationsForExpandedState = durations
|
||||
cell.durationsForCollapsedState = durations
|
||||
return cell
|
||||
}
|
||||
|
||||
var duration = 0.0
|
||||
let cellIsCollapsed = cellHeights[indexPath.row] == kCloseCellHeight
|
||||
if cellIsCollapsed {
|
||||
cellHeights[indexPath.row] = kOpenCellHeight
|
||||
cell.selectedAnimation(true, animated: true, completion: nil)
|
||||
duration = 0.5
|
||||
} else {
|
||||
cellHeights[indexPath.row] = kCloseCellHeight
|
||||
cell.selectedAnimation(false, animated: true, completion: nil)
|
||||
duration = 0.8
|
||||
|
||||
override func tableView(_: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
||||
return cellHeights[indexPath.row]
|
||||
}
|
||||
|
||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
|
||||
let cell = tableView.cellForRow(at: indexPath) as! FoldingCell
|
||||
|
||||
if cell.isAnimating() {
|
||||
return
|
||||
}
|
||||
|
||||
var duration = 0.0
|
||||
let cellIsCollapsed = cellHeights[indexPath.row] == Const.closeCellHeight
|
||||
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.animate(withDuration: duration, delay: 0, options: .curveEaseOut, animations: { () -> Void in
|
||||
tableView.beginUpdates()
|
||||
tableView.endUpdates()
|
||||
}, completion: nil)
|
||||
}
|
||||
|
||||
UIView.animate(withDuration: duration, delay: 0, options: .curveEaseOut, animations: { () -> Void in
|
||||
tableView.beginUpdates()
|
||||
tableView.endUpdates()
|
||||
}, completion: nil)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,36 +16,7 @@
|
||||
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
// Override point for customization after application launch.
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application {
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
||||
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11106"/>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
@@ -16,12 +21,33 @@
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2018 Ramotion. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fcf-sN-ku0">
|
||||
<rect key="frame" x="16" y="630" width="343" height="17"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Folding Cell" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bCd-3b-lHA">
|
||||
<rect key="frame" x="139.5" y="323" width="96" height="21"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="fcf-sN-ku0" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leadingMargin" id="811-hI-Egq"/>
|
||||
<constraint firstItem="bCd-3b-lHA" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="T4x-O3-JqD"/>
|
||||
<constraint firstItem="bCd-3b-lHA" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="VFr-tp-sPw"/>
|
||||
<constraint firstItem="fcf-sN-ku0" firstAttribute="trailing" secondItem="Ze5-6b-2t3" secondAttribute="trailingMargin" id="dS9-pv-ebe"/>
|
||||
<constraint firstItem="xb3-aO-Qok" firstAttribute="top" secondItem="fcf-sN-ku0" secondAttribute="bottom" constant="20" id="kbD-dX-t3N"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
<point key="canvasLocation" x="52" y="374.66266866566718"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="0cn-rv-Emg">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="0cn-rv-Emg">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<customFonts key="customFonts">
|
||||
@@ -22,7 +23,7 @@
|
||||
<!--Item-->
|
||||
<scene sceneID="Q2d-BE-geS">
|
||||
<objects>
|
||||
<tableViewController storyboardIdentifier="TableViewController" id="0cn-rv-Emg" customClass="TableViewController" sceneMemberID="viewController">
|
||||
<tableViewController storyboardIdentifier="TableViewController" id="0cn-rv-Emg" customClass="MainTableViewController" customModule="FoldingCell_Demo" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="667" sectionHeaderHeight="28" sectionFooterHeight="28" id="MwZ-K3-six">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
|
||||
@@ -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,7 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
8498513F1C5639F9006FA400 /* FoldingCellTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8498513E1C5639F9006FA400 /* FoldingCellTests.swift */; };
|
||||
5A0E1C3021414940006A0374 /* FoldingCellDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5A0E1C2F21414940006A0374 /* FoldingCellDemoTests.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 */; };
|
||||
@@ -29,6 +29,13 @@
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
5A0E1C3221414940006A0374 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 847A57FC1C294F750028FB84 /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = 9D57F31B1EDC7A6F0004599F;
|
||||
remoteInfo = "FoldingCell-Demo";
|
||||
};
|
||||
9D57F3361EDC7AD80004599F /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 847A57FC1C294F750028FB84 /* Project object */;
|
||||
@@ -71,9 +78,9 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* 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>"; };
|
||||
5A0E1C2D21414940006A0374 /* FoldingCellDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FoldingCellDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
5A0E1C2F21414940006A0374 /* FoldingCellDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FoldingCellDemoTests.swift; sourceTree = "<group>"; };
|
||||
5A0E1C3121414940006A0374 /* 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>"; };
|
||||
@@ -99,7 +106,7 @@
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
849851391C5639F9006FA400 /* Frameworks */ = {
|
||||
5A0E1C2A21414940006A0374 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
@@ -132,13 +139,22 @@
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
5A0E1C2E21414940006A0374 /* FoldingCellDemoTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5A0E1C2F21414940006A0374 /* FoldingCellDemoTests.swift */,
|
||||
5A0E1C3121414940006A0374 /* Info.plist */,
|
||||
);
|
||||
path = FoldingCellDemoTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
847A57FB1C294F750028FB84 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8499D8861D0054A8004B5B37 /* FoldingCell */,
|
||||
8498513D1C5639F9006FA400 /* FoldingCellTests */,
|
||||
9D57F31D1EDC7A6F0004599F /* FoldingCell-Demo */,
|
||||
9DAA51551EDDBAD700DFC539 /* FoldingCell-DemoObjc */,
|
||||
5A0E1C2E21414940006A0374 /* FoldingCellDemoTests */,
|
||||
847A58051C294F750028FB84 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
@@ -146,23 +162,14 @@
|
||||
847A58051C294F750028FB84 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8498513C1C5639F9006FA400 /* FoldingCellTests.xctest */,
|
||||
8499D8851D0054A8004B5B37 /* FoldingCell.framework */,
|
||||
9D57F31C1EDC7A6F0004599F /* FoldingCell-Demo.app */,
|
||||
9DAA51541EDDBAD700DFC539 /* FoldingCell-DemoObjc.app */,
|
||||
5A0E1C2D21414940006A0374 /* FoldingCellDemoTests.xctest */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8498513D1C5639F9006FA400 /* FoldingCellTests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8498513E1C5639F9006FA400 /* FoldingCellTests.swift */,
|
||||
849851401C5639F9006FA400 /* Info.plist */,
|
||||
);
|
||||
path = FoldingCellTests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
8499D8861D0054A8004B5B37 /* FoldingCell */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -225,21 +232,22 @@
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
8498513B1C5639F9006FA400 /* FoldingCellTests */ = {
|
||||
5A0E1C2C21414940006A0374 /* FoldingCellDemoTests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 849851431C5639F9006FA400 /* Build configuration list for PBXNativeTarget "FoldingCellTests" */;
|
||||
buildConfigurationList = 5A0E1C3421414940006A0374 /* Build configuration list for PBXNativeTarget "FoldingCellDemoTests" */;
|
||||
buildPhases = (
|
||||
849851381C5639F9006FA400 /* Sources */,
|
||||
849851391C5639F9006FA400 /* Frameworks */,
|
||||
8498513A1C5639F9006FA400 /* Resources */,
|
||||
5A0E1C2921414940006A0374 /* Sources */,
|
||||
5A0E1C2A21414940006A0374 /* Frameworks */,
|
||||
5A0E1C2B21414940006A0374 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
5A0E1C3321414940006A0374 /* PBXTargetDependency */,
|
||||
);
|
||||
name = FoldingCellTests;
|
||||
productName = FoldingCellTests;
|
||||
productReference = 8498513C1C5639F9006FA400 /* FoldingCellTests.xctest */;
|
||||
name = FoldingCellDemoTests;
|
||||
productName = FoldingCellDemoTests;
|
||||
productReference = 5A0E1C2D21414940006A0374 /* FoldingCellDemoTests.xctest */;
|
||||
productType = "com.apple.product-type.bundle.unit-test";
|
||||
};
|
||||
8499D8841D0054A8004B5B37 /* FoldingCell */ = {
|
||||
@@ -304,24 +312,25 @@
|
||||
847A57FC1C294F750028FB84 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0830;
|
||||
LastUpgradeCheck = 0800;
|
||||
LastSwiftUpdateCheck = 0940;
|
||||
LastUpgradeCheck = 0940;
|
||||
ORGANIZATIONNAME = "Alex K.";
|
||||
TargetAttributes = {
|
||||
8498513B1C5639F9006FA400 = {
|
||||
CreatedOnToolsVersion = 7.2;
|
||||
DevelopmentTeam = 2VFCBFYPFW;
|
||||
LastSwiftMigration = 0800;
|
||||
TestTargetID = 847A58031C294F750028FB84;
|
||||
5A0E1C2C21414940006A0374 = {
|
||||
CreatedOnToolsVersion = 9.4;
|
||||
LastSwiftMigration = 1000;
|
||||
ProvisioningStyle = Automatic;
|
||||
TestTargetID = 9D57F31B1EDC7A6F0004599F;
|
||||
};
|
||||
8499D8841D0054A8004B5B37 = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
DevelopmentTeam = 2VFCBFYPFW;
|
||||
LastSwiftMigration = 0830;
|
||||
DevelopmentTeam = LEAZS7L33U;
|
||||
LastSwiftMigration = 1000;
|
||||
};
|
||||
9D57F31B1EDC7A6F0004599F = {
|
||||
CreatedOnToolsVersion = 8.3.2;
|
||||
DevelopmentTeam = 2VFCBFYPFW;
|
||||
DevelopmentTeam = 34MUF9YXTA;
|
||||
LastSwiftMigration = 1000;
|
||||
ProvisioningStyle = Automatic;
|
||||
};
|
||||
9DAA51531EDDBAD700DFC539 = {
|
||||
@@ -347,13 +356,13 @@
|
||||
8499D8841D0054A8004B5B37 /* FoldingCell */,
|
||||
9D57F31B1EDC7A6F0004599F /* FoldingCell-Demo */,
|
||||
9DAA51531EDDBAD700DFC539 /* FoldingCell-DemoObjc */,
|
||||
8498513B1C5639F9006FA400 /* FoldingCellTests */,
|
||||
5A0E1C2C21414940006A0374 /* FoldingCellDemoTests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
8498513A1C5639F9006FA400 /* Resources */ = {
|
||||
5A0E1C2B21414940006A0374 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
@@ -390,11 +399,11 @@
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
849851381C5639F9006FA400 /* Sources */ = {
|
||||
5A0E1C2921414940006A0374 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
8498513F1C5639F9006FA400 /* FoldingCellTests.swift in Sources */,
|
||||
5A0E1C3021414940006A0374 /* FoldingCellDemoTests.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -429,6 +438,11 @@
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
5A0E1C3321414940006A0374 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 9D57F31B1EDC7A6F0004599F /* FoldingCell-Demo */;
|
||||
targetProxy = 5A0E1C3221414940006A0374 /* PBXContainerItemProxy */;
|
||||
};
|
||||
9D57F3371EDC7AD80004599F /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = 8499D8841D0054A8004B5B37 /* FoldingCell */;
|
||||
@@ -477,6 +491,53 @@
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
5A0E1C3521414940006A0374 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
INFOPLIST_FILE = FoldingCellDemoTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.FoldingCellDemoTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_VERSION = 4.2;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FoldingCell-Demo.app/FoldingCell-Demo";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
5A0E1C3621414940006A0374 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
INFOPLIST_FILE = FoldingCellDemoTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.FoldingCellDemoTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 4.2;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FoldingCell-Demo.app/FoldingCell-Demo";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
847A58141C294F750028FB84 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
@@ -485,14 +546,22 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
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;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@@ -515,7 +584,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;
|
||||
@@ -531,14 +600,22 @@
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
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;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
@@ -555,7 +632,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";
|
||||
@@ -563,36 +640,6 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
849851441C5639F9006FA400 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = 2VFCBFYPFW;
|
||||
INFOPLIST_FILE = FoldingCellTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.FoldingCellTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FoldingCellDemo.app/FoldingCellDemo";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
849851451C5639F9006FA400 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = 2VFCBFYPFW;
|
||||
INFOPLIST_FILE = FoldingCellTests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.FoldingCellTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/FoldingCellDemo.app/FoldingCellDemo";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
8499D88F1D0054A8004B5B37 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
@@ -602,7 +649,7 @@
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = 2VFCBFYPFW;
|
||||
DEVELOPMENT_TEAM = LEAZS7L33U;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
@@ -614,7 +661,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
@@ -630,7 +677,7 @@
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = 2VFCBFYPFW;
|
||||
DEVELOPMENT_TEAM = LEAZS7L33U;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
@@ -641,7 +688,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.FoldingCell;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
@@ -658,7 +705,7 @@
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
DEVELOPMENT_TEAM = 2VFCBFYPFW;
|
||||
DEVELOPMENT_TEAM = 34MUF9YXTA;
|
||||
INFOPLIST_FILE = "FoldingCell-Demo/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
@@ -666,7 +713,7 @@
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -680,14 +727,14 @@
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
DEVELOPMENT_TEAM = 2VFCBFYPFW;
|
||||
DEVELOPMENT_TEAM = 34MUF9YXTA;
|
||||
INFOPLIST_FILE = "FoldingCell-Demo/Info.plist";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "ramotion.com.FoldingCell-Demo";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 4.2;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -734,6 +781,15 @@
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
5A0E1C3421414940006A0374 /* Build configuration list for PBXNativeTarget "FoldingCellDemoTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
5A0E1C3521414940006A0374 /* Debug */,
|
||||
5A0E1C3621414940006A0374 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
847A57FF1C294F750028FB84 /* Build configuration list for PBXProject "FoldingCell" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
@@ -743,15 +799,6 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
849851431C5639F9006FA400 /* Build configuration list for PBXNativeTarget "FoldingCellTests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
849851441C5639F9006FA400 /* Debug */,
|
||||
849851451C5639F9006FA400 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
8499D88E1D0054A8004B5B37 /* Build configuration list for PBXNativeTarget "FoldingCell" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
@@ -777,6 +824,7 @@
|
||||
9DAA51691EDDBAD700DFC539 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
|
||||
+8
@@ -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 = "0800"
|
||||
LastUpgradeVersion = "0940"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -25,498 +25,489 @@ import UIKit
|
||||
|
||||
/// UITableViewCell with folding animation
|
||||
open class FoldingCell: UITableViewCell {
|
||||
|
||||
/// UIView whitch display when cell open
|
||||
@IBOutlet weak open var containerView: UIView!
|
||||
@IBOutlet weak open var containerViewTop: NSLayoutConstraint!
|
||||
|
||||
/// UIView whitch display when cell close
|
||||
@IBOutlet weak open var foregroundView: RotatedView!
|
||||
@IBOutlet weak open var foregroundViewTop: NSLayoutConstraint!
|
||||
var animationView: UIView?
|
||||
|
||||
/// the number of folding elements. Default 2
|
||||
@IBInspectable open var itemCount: NSInteger = 2
|
||||
|
||||
/// The color of the back cell
|
||||
@IBInspectable open var backViewColor: UIColor = UIColor.brown
|
||||
|
||||
var animationItemViews: [RotatedView]?
|
||||
|
||||
/**
|
||||
Folding animation types
|
||||
|
||||
- Open: Open direction
|
||||
- Close: Close direction
|
||||
*/
|
||||
public enum AnimationType {
|
||||
case open
|
||||
case close
|
||||
}
|
||||
|
||||
// MARK: life cicle
|
||||
|
||||
override public init(style: UITableViewCellStyle, reuseIdentifier: String?) {
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
}
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
}
|
||||
|
||||
override open func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
commonInit()
|
||||
}
|
||||
|
||||
/**
|
||||
Call this method in methods init(style: UITableViewCellStyle, reuseIdentifier: String?) after creating Views
|
||||
*/
|
||||
open func commonInit() {
|
||||
configureDefaultState()
|
||||
/// UIView is displayed when cell open
|
||||
@IBOutlet open var containerView: UIView!
|
||||
@IBOutlet open var containerViewTop: NSLayoutConstraint!
|
||||
|
||||
self.selectionStyle = .none
|
||||
/// UIView whitch display when cell close
|
||||
@IBOutlet open var foregroundView: RotatedView!
|
||||
@IBOutlet open var foregroundViewTop: NSLayoutConstraint!
|
||||
var animationView: UIView?
|
||||
|
||||
containerView.layer.cornerRadius = foregroundView.layer.cornerRadius
|
||||
containerView.layer.masksToBounds = true
|
||||
}
|
||||
|
||||
|
||||
// MARK: configure
|
||||
|
||||
func configureDefaultState() {
|
||||
/// the number of folding elements. Default 2
|
||||
@IBInspectable open var itemCount: NSInteger = 2
|
||||
|
||||
guard let foregroundViewTop = self.foregroundViewTop,
|
||||
let containerViewTop = self.containerViewTop else {
|
||||
fatalError("set constratins outlets")
|
||||
/// The color of the back cell
|
||||
@IBInspectable open var backViewColor: UIColor = UIColor.brown
|
||||
|
||||
var animationItemViews: [RotatedView]?
|
||||
|
||||
/**
|
||||
Folding animation types
|
||||
|
||||
- Open: Open direction
|
||||
- Close: Close direction
|
||||
*/
|
||||
@objc public enum AnimationType : Int {
|
||||
case open
|
||||
case close
|
||||
}
|
||||
|
||||
containerViewTop.constant = foregroundViewTop.constant
|
||||
containerView.alpha = 0
|
||||
// MARK: Life Cycle
|
||||
|
||||
if let height = (foregroundView.constraints.filter { $0.firstAttribute == .height && $0.secondItem == nil}).first?.constant {
|
||||
foregroundView.layer.anchorPoint = CGPoint(x: 0.5, y: 1)
|
||||
foregroundViewTop.constant += height / 2
|
||||
}
|
||||
foregroundView.layer.transform = foregroundView.transform3d()
|
||||
|
||||
createAnimationView()
|
||||
self.contentView.bringSubview(toFront: foregroundView)
|
||||
}
|
||||
|
||||
func createAnimationItemView()->[RotatedView] {
|
||||
guard let animationView = self.animationView else {
|
||||
fatalError()
|
||||
open override func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
commonInit()
|
||||
}
|
||||
|
||||
var items = [RotatedView]()
|
||||
items.append(foregroundView)
|
||||
var rotatedViews = [RotatedView]()
|
||||
for case let itemView as RotatedView in animationView.subviews.filter({$0 is RotatedView}).sorted(by: {$0.tag < $1.tag}) {
|
||||
rotatedViews.append(itemView)
|
||||
if let backView = itemView.backView {
|
||||
rotatedViews.append(backView)
|
||||
}
|
||||
}
|
||||
items.append(contentsOf: rotatedViews)
|
||||
return items
|
||||
}
|
||||
|
||||
func configureAnimationItems(_ animationType: AnimationType) {
|
||||
|
||||
guard let animationViewSuperView = animationView?.subviews else {
|
||||
fatalError()
|
||||
/**
|
||||
Call this method in methods init(style: UITableViewCellStyle, reuseIdentifier: String?) after creating Views
|
||||
*/
|
||||
@objc open func commonInit() {
|
||||
configureDefaultState()
|
||||
|
||||
selectionStyle = .none
|
||||
|
||||
containerView.layer.cornerRadius = foregroundView.layer.cornerRadius
|
||||
containerView.layer.masksToBounds = true
|
||||
}
|
||||
|
||||
if animationType == .open {
|
||||
for view in animationViewSuperView.filter({$0 is RotatedView}) {
|
||||
view.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
|
||||
// MARK: configure
|
||||
|
||||
func configureDefaultState() {
|
||||
|
||||
guard let foregroundViewTop = self.foregroundViewTop,
|
||||
let containerViewTop = self.containerViewTop else {
|
||||
fatalError("set foregroundViewTop or containerViewTop outlets in storyboard")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func createAnimationView() {
|
||||
animationView = UIView(frame: containerView.frame)
|
||||
animationView?.layer.cornerRadius = foregroundView.layer.cornerRadius
|
||||
animationView?.backgroundColor = .clear
|
||||
animationView?.translatesAutoresizingMaskIntoConstraints = false
|
||||
animationView?.alpha = 0
|
||||
|
||||
guard let animationView = self.animationView else { return }
|
||||
|
||||
self.contentView.addSubview(animationView)
|
||||
|
||||
// copy constraints from containerView
|
||||
var newConstraints = [NSLayoutConstraint]()
|
||||
for constraint in self.contentView.constraints {
|
||||
if let item = constraint.firstItem as? UIView , item == containerView {
|
||||
let newConstraint = NSLayoutConstraint( item: animationView, attribute: constraint.firstAttribute,
|
||||
relatedBy: constraint.relation, toItem: constraint.secondItem, attribute: constraint.secondAttribute,
|
||||
multiplier: constraint.multiplier, constant: constraint.constant)
|
||||
|
||||
newConstraints.append(newConstraint)
|
||||
} else if let item: UIView = constraint.secondItem as? UIView , item == containerView {
|
||||
let newConstraint = NSLayoutConstraint(item: constraint.firstItem, attribute: constraint.firstAttribute,
|
||||
relatedBy: constraint.relation, toItem: animationView, attribute: constraint.secondAttribute,
|
||||
multiplier: constraint.multiplier, constant: constraint.constant)
|
||||
containerViewTop.constant = foregroundViewTop.constant
|
||||
containerView.alpha = 0
|
||||
|
||||
newConstraints.append(newConstraint)
|
||||
}
|
||||
}
|
||||
self.contentView.addConstraints(newConstraints)
|
||||
|
||||
for constraint in containerView.constraints { // added height constraint
|
||||
if constraint.firstAttribute == .height, let item: UIView = constraint.firstItem as? UIView, item == containerView {
|
||||
let newConstraint = NSLayoutConstraint(item: animationView, attribute: constraint.firstAttribute,
|
||||
relatedBy: constraint.relation, toItem: nil, attribute: constraint.secondAttribute,
|
||||
multiplier: constraint.multiplier, constant: constraint.constant)
|
||||
if let height = (foregroundView.constraints.filter { $0.firstAttribute == .height && $0.secondItem == nil }).first?.constant {
|
||||
foregroundView.layer.anchorPoint = CGPoint(x: 0.5, y: 1)
|
||||
foregroundViewTop.constant += height / 2
|
||||
}
|
||||
foregroundView.layer.transform = foregroundView.transform3d()
|
||||
|
||||
animationView.addConstraint(newConstraint)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func addImageItemsToAnimationView() {
|
||||
containerView.alpha = 1;
|
||||
let containerViewSize = containerView.bounds.size
|
||||
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 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))
|
||||
|
||||
imageView = UIImageView(image: image)
|
||||
let rotatedView = RotatedView(frame: imageView.frame)
|
||||
rotatedView.tag = 1
|
||||
rotatedView.layer.anchorPoint = CGPoint.init(x: 0.5, y: 0)
|
||||
rotatedView.layer.transform = rotatedView.transform3d()
|
||||
|
||||
rotatedView.addSubview(imageView)
|
||||
animationView?.addSubview(rotatedView)
|
||||
rotatedView.frame = CGRect(x: imageView.frame.origin.x, y: foregroundViewSize.height, width: containerViewSize.width, height: foregroundViewSize.height)
|
||||
|
||||
// added other views
|
||||
let itemHeight = (containerViewSize.height - 2 * foregroundViewSize.height) / CGFloat(itemCount - 2)
|
||||
|
||||
if itemCount == 2 {
|
||||
// decrease containerView height or increase itemCount
|
||||
assert(containerViewSize.height - 2 * foregroundViewSize.height == 0, "contanerView.height too high")
|
||||
}
|
||||
else{
|
||||
// decrease containerView height or increase itemCount
|
||||
assert(containerViewSize.height - 2 * foregroundViewSize.height >= itemHeight, "contanerView.height too high")
|
||||
createAnimationView()
|
||||
contentView.bringSubviewToFront(foregroundView)
|
||||
}
|
||||
|
||||
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))
|
||||
|
||||
imageView = UIImageView(image: image)
|
||||
let rotatedView = RotatedView(frame: imageView.frame)
|
||||
|
||||
rotatedView.addSubview(imageView)
|
||||
rotatedView.layer.anchorPoint = CGPoint.init(x: 0.5, y: 0)
|
||||
rotatedView.layer.transform = rotatedView.transform3d()
|
||||
animationView?.addSubview(rotatedView)
|
||||
rotatedView.frame = CGRect(x: 0, y: yPosition, width: rotatedView.bounds.size.width, height: itemHeight)
|
||||
rotatedView.tag = tag
|
||||
|
||||
yPosition += itemHeight
|
||||
tag += 1
|
||||
func createAnimationItemView() -> [RotatedView] {
|
||||
|
||||
var items = [RotatedView]()
|
||||
items.append(foregroundView)
|
||||
var rotatedViews = [RotatedView]()
|
||||
|
||||
animationView?.subviews
|
||||
.lazy
|
||||
.compactMap({ $0 as? RotatedView })
|
||||
.sorted(by: { $0.tag < $1.tag })
|
||||
.forEach { itemView in
|
||||
rotatedViews.append(itemView)
|
||||
if let backView = itemView.backView {
|
||||
rotatedViews.append(backView)
|
||||
}
|
||||
}
|
||||
|
||||
items.append(contentsOf: rotatedViews)
|
||||
return items
|
||||
}
|
||||
|
||||
containerView.alpha = 0;
|
||||
|
||||
if let animationView = self.animationView {
|
||||
// added back view
|
||||
var previuosView: RotatedView?
|
||||
for case let container as RotatedView in animationView.subviews.sorted(by: { $0.tag < $1.tag })
|
||||
where container.tag > 0 && container.tag < animationView.subviews.count {
|
||||
previuosView?.addBackView(container.bounds.size.height, color: backViewColor)
|
||||
previuosView = container
|
||||
}
|
||||
}
|
||||
animationItemViews = createAnimationItemView()
|
||||
}
|
||||
|
||||
fileprivate func removeImageItemsFromAnimationView() {
|
||||
|
||||
guard let animationView = self.animationView else {
|
||||
return
|
||||
}
|
||||
|
||||
animationView.subviews.forEach({ $0.removeFromSuperview() })
|
||||
}
|
||||
|
||||
|
||||
// MARK: public
|
||||
|
||||
/// Unfold cell.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - 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) -> Void)? = nil) {
|
||||
if animated {
|
||||
value ? openAnimation(completion) : closeAnimation(completion)
|
||||
} else {
|
||||
foregroundView.alpha = value ? 0 : 1
|
||||
containerView.alpha = value ? 1 : 0
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Open or close cell
|
||||
|
||||
- parameter isSelected: Specify true if you want to open cell or false if you close cell.
|
||||
- parameter animated: Specify true if you want to animate the change in visibility or false if you want immediately.
|
||||
- parameter completion: A block object to be executed when the animation sequence ends.
|
||||
*/
|
||||
@available(iOS, deprecated, message: "Use unfold(_:animated:completion) method instead.")
|
||||
open func selectedAnimation(_ isSelected: Bool, animated: Bool, completion: ((Void) -> Void)?) {
|
||||
unfold(isSelected, animated: animated, completion: completion)
|
||||
}
|
||||
|
||||
open func isAnimating() -> Bool {
|
||||
return animationView?.alpha == 1 ? true : false
|
||||
}
|
||||
|
||||
open var isUnfolded = false
|
||||
|
||||
// MARK: Animations
|
||||
open func animationDuration(_ itemIndex: NSInteger, type: AnimationType) -> TimeInterval {
|
||||
return type == .close ? durationsForCollapsedState[itemIndex] : durationsForExpandedState[itemIndex]
|
||||
}
|
||||
|
||||
open var durationsForExpandedState: [TimeInterval] = []
|
||||
open var durationsForCollapsedState: [TimeInterval] = []
|
||||
|
||||
func durationSequence(_ type: AnimationType)-> [TimeInterval] {
|
||||
var durations = [TimeInterval]()
|
||||
for i in 0..<itemCount-1 {
|
||||
let duration = animationDuration(i, type: type)
|
||||
durations.append(TimeInterval(duration / 2.0))
|
||||
durations.append(TimeInterval(duration / 2.0))
|
||||
}
|
||||
return durations
|
||||
}
|
||||
|
||||
func openAnimation(_ completion: ((Void) -> Void)?) {
|
||||
isUnfolded = true
|
||||
removeImageItemsFromAnimationView()
|
||||
addImageItemsToAnimationView()
|
||||
|
||||
guard let animationView = self.animationView else {
|
||||
return
|
||||
func configureAnimationItems(_ animationType: AnimationType) {
|
||||
|
||||
if animationType == .open {
|
||||
animationView?.subviews
|
||||
.lazy
|
||||
.compactMap { $0 as? RotatedView }
|
||||
.forEach { $0.alpha = 0 }
|
||||
} else {
|
||||
animationView?.subviews
|
||||
.lazy
|
||||
.compactMap { $0 as? RotatedView }
|
||||
.forEach {
|
||||
if animationType == .open {
|
||||
$0.alpha = 0
|
||||
} else {
|
||||
$0.alpha = 1
|
||||
$0.backView?.alpha = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
animationView.alpha = 1
|
||||
containerView.alpha = 0
|
||||
|
||||
let durations = durationSequence(.open)
|
||||
|
||||
var delay: TimeInterval = 0
|
||||
var timing = kCAMediaTimingFunctionEaseIn
|
||||
var from: CGFloat = 0.0;
|
||||
var to: CGFloat = -CGFloat.pi / 2
|
||||
var hidden = true
|
||||
configureAnimationItems(.open)
|
||||
|
||||
guard let animationItemViews = self.animationItemViews else {
|
||||
return
|
||||
func createAnimationView() {
|
||||
animationView = UIView(frame: containerView.frame)
|
||||
animationView?.layer.cornerRadius = foregroundView.layer.cornerRadius
|
||||
animationView?.backgroundColor = .clear
|
||||
animationView?.translatesAutoresizingMaskIntoConstraints = false
|
||||
animationView?.alpha = 0
|
||||
|
||||
guard let animationView = self.animationView else { return }
|
||||
|
||||
self.contentView.addSubview(animationView)
|
||||
|
||||
// copy constraints from containerView
|
||||
var newConstraints = [NSLayoutConstraint]()
|
||||
for constraint in self.contentView.constraints {
|
||||
if let item = constraint.firstItem as? UIView, item == containerView {
|
||||
let newConstraint = NSLayoutConstraint(item: animationView, attribute: constraint.firstAttribute,
|
||||
relatedBy: constraint.relation, toItem: constraint.secondItem, attribute: constraint.secondAttribute,
|
||||
multiplier: constraint.multiplier, constant: constraint.constant)
|
||||
|
||||
newConstraints.append(newConstraint)
|
||||
} else if let firstItem = constraint.firstItem as? UIView, let secondItem: UIView = constraint.secondItem as? UIView, secondItem == containerView {
|
||||
let newConstraint = NSLayoutConstraint(item: firstItem, attribute: constraint.firstAttribute,
|
||||
relatedBy: constraint.relation, toItem: animationView, attribute: constraint.secondAttribute,
|
||||
multiplier: constraint.multiplier, constant: constraint.constant)
|
||||
|
||||
newConstraints.append(newConstraint)
|
||||
}
|
||||
}
|
||||
self.contentView.addConstraints(newConstraints)
|
||||
|
||||
for constraint in containerView.constraints { // added height constraint
|
||||
if constraint.firstAttribute == .height, let item: UIView = constraint.firstItem as? UIView, item == containerView {
|
||||
let newConstraint = NSLayoutConstraint(item: animationView, attribute: constraint.firstAttribute,
|
||||
relatedBy: constraint.relation, toItem: nil, attribute: constraint.secondAttribute,
|
||||
multiplier: constraint.multiplier, constant: constraint.constant)
|
||||
|
||||
animationView.addConstraint(newConstraint)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for index in 0..<animationItemViews.count {
|
||||
let animatedView = animationItemViews[index]
|
||||
|
||||
animatedView.foldingAnimation(timing, from: from, to: to, duration: durations[index], delay: delay, hidden: hidden)
|
||||
|
||||
from = from == 0.0 ? CGFloat.pi / 2 : 0.0
|
||||
to = to == 0.0 ? -CGFloat.pi / 2 : 0.0
|
||||
timing = timing == kCAMediaTimingFunctionEaseIn ? kCAMediaTimingFunctionEaseOut : kCAMediaTimingFunctionEaseIn
|
||||
hidden = !hidden
|
||||
delay += durations[index]
|
||||
func addImageItemsToAnimationView() {
|
||||
containerView.alpha = 1
|
||||
let containerViewSize = containerView.bounds.size
|
||||
let foregroundViewSize = foregroundView.bounds.size
|
||||
|
||||
// added first item
|
||||
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.takeSnapshot(CGRect(x: 0, y: foregroundViewSize.height, width: containerViewSize.width, height: foregroundViewSize.height))
|
||||
|
||||
imageView = UIImageView(image: image)
|
||||
let rotatedView = RotatedView(frame: imageView.frame)
|
||||
rotatedView.tag = 1
|
||||
rotatedView.layer.anchorPoint = CGPoint(x: 0.5, y: 0)
|
||||
rotatedView.layer.transform = rotatedView.transform3d()
|
||||
|
||||
rotatedView.addSubview(imageView)
|
||||
animationView?.addSubview(rotatedView)
|
||||
rotatedView.frame = CGRect(x: imageView.frame.origin.x, y: foregroundViewSize.height, width: containerViewSize.width, height: foregroundViewSize.height)
|
||||
|
||||
// added other views
|
||||
let itemHeight = (containerViewSize.height - 2 * foregroundViewSize.height) / CGFloat(itemCount - 2)
|
||||
|
||||
if itemCount == 2 {
|
||||
// decrease containerView height or increase itemCount
|
||||
assert(containerViewSize.height - 2 * foregroundViewSize.height == 0, "contanerView.height too high")
|
||||
} else {
|
||||
// decrease containerView height or increase itemCount
|
||||
assert(containerViewSize.height - 2 * foregroundViewSize.height >= itemHeight, "contanerView.height too high")
|
||||
}
|
||||
|
||||
var yPosition = 2 * foregroundViewSize.height
|
||||
var tag = 2
|
||||
for _ in 2 ..< itemCount {
|
||||
image = containerView.takeSnapshot(CGRect(x: 0, y: yPosition, width: containerViewSize.width, height: itemHeight))
|
||||
|
||||
imageView = UIImageView(image: image)
|
||||
let rotatedView = RotatedView(frame: imageView.frame)
|
||||
|
||||
rotatedView.addSubview(imageView)
|
||||
rotatedView.layer.anchorPoint = CGPoint(x: 0.5, y: 0)
|
||||
rotatedView.layer.transform = rotatedView.transform3d()
|
||||
animationView?.addSubview(rotatedView)
|
||||
rotatedView.frame = CGRect(x: 0, y: yPosition, width: rotatedView.bounds.size.width, height: itemHeight)
|
||||
rotatedView.tag = tag
|
||||
|
||||
yPosition += itemHeight
|
||||
tag += 1
|
||||
}
|
||||
|
||||
containerView.alpha = 0
|
||||
|
||||
if let animationView = self.animationView {
|
||||
// added back view
|
||||
var previuosView: RotatedView?
|
||||
for case let container as RotatedView in animationView.subviews.sorted(by: { $0.tag < $1.tag })
|
||||
where container.tag > 0 && container.tag < animationView.subviews.count {
|
||||
previuosView?.addBackView(container.bounds.size.height, color: backViewColor)
|
||||
previuosView = container
|
||||
}
|
||||
}
|
||||
animationItemViews = createAnimationItemView()
|
||||
}
|
||||
|
||||
let firstItemView = animationView.subviews.filter { $0.tag == 0 }.first
|
||||
|
||||
firstItemView?.layer.masksToBounds = true
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + durations[0], execute: {
|
||||
firstItemView?.layer.cornerRadius = 0
|
||||
})
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
|
||||
self.animationView?.alpha = 0
|
||||
self.containerView.alpha = 1
|
||||
completion?()
|
||||
}
|
||||
}
|
||||
|
||||
func closeAnimation(_ completion: ((Void) -> Void)?) {
|
||||
isUnfolded = false
|
||||
removeImageItemsFromAnimationView()
|
||||
addImageItemsToAnimationView()
|
||||
|
||||
guard let animationItemViews = self.animationItemViews else {
|
||||
fatalError()
|
||||
fileprivate func removeImageItemsFromAnimationView() {
|
||||
|
||||
guard let animationView = self.animationView else {
|
||||
return
|
||||
}
|
||||
|
||||
animationView.subviews.forEach({ $0.removeFromSuperview() })
|
||||
}
|
||||
|
||||
animationView?.alpha = 1
|
||||
containerView.alpha = 0
|
||||
// MARK: public
|
||||
|
||||
var durations: [TimeInterval] = durationSequence(.close).reversed()
|
||||
|
||||
var delay: TimeInterval = 0
|
||||
var timing = kCAMediaTimingFunctionEaseIn
|
||||
var from: CGFloat = 0.0
|
||||
var to: CGFloat = CGFloat.pi / 2
|
||||
var hidden = true
|
||||
configureAnimationItems(.close)
|
||||
|
||||
if durations.count < animationItemViews.count {
|
||||
fatalError("wrong override func animationDuration(itemIndex:NSInteger, type:AnimationType)-> NSTimeInterval")
|
||||
/// Unfold cell.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - value: unfold = true; collapse = false.
|
||||
/// - animated: animate changes.
|
||||
/// - completion: A block object to be executed when the animation sequence ends.
|
||||
@objc open func unfold(_ value: Bool, animated: Bool = true, completion: (() -> Void)? = nil) {
|
||||
if animated {
|
||||
value ? openAnimation(completion) : closeAnimation(completion)
|
||||
} else {
|
||||
foregroundView.alpha = value ? 0 : 1
|
||||
containerView.alpha = value ? 1 : 0
|
||||
}
|
||||
}
|
||||
for index in 0..<animationItemViews.count {
|
||||
let animatedView = animationItemViews.reversed()[index]
|
||||
|
||||
animatedView.foldingAnimation(timing, from: from, to: to, duration: durations[index], delay: delay, hidden: hidden)
|
||||
|
||||
to = to == 0.0 ? CGFloat.pi / 2 : 0.0
|
||||
from = from == 0.0 ? -CGFloat.pi / 2 : 0.0
|
||||
timing = timing == kCAMediaTimingFunctionEaseIn ? kCAMediaTimingFunctionEaseOut : kCAMediaTimingFunctionEaseIn
|
||||
hidden = !hidden
|
||||
delay += durations[index]
|
||||
}
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + delay, execute: {
|
||||
self.animationView?.alpha = 0
|
||||
completion?()
|
||||
})
|
||||
|
||||
let firstItemView = animationView?.subviews.filter { $0.tag == 0 }.first
|
||||
firstItemView?.layer.cornerRadius = 0
|
||||
firstItemView?.layer.masksToBounds = true
|
||||
if let durationFirst = durations.first {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + delay - durationFirst * 2, execute: {
|
||||
firstItemView?.layer.cornerRadius = self.foregroundView.layer.cornerRadius
|
||||
firstItemView?.setNeedsDisplay()
|
||||
firstItemView?.setNeedsLayout()
|
||||
})
|
||||
@objc open func isAnimating() -> Bool {
|
||||
return animationView?.alpha == 1 ? true : false
|
||||
}
|
||||
|
||||
@objc open var isUnfolded = false
|
||||
|
||||
// MARK: Animations
|
||||
|
||||
@objc open func animationDuration(_ itemIndex: NSInteger, type: AnimationType) -> TimeInterval {
|
||||
return type == .close ? durationsForCollapsedState[itemIndex] : durationsForExpandedState[itemIndex]
|
||||
}
|
||||
|
||||
@objc open var durationsForExpandedState: [TimeInterval] = []
|
||||
@objc open var durationsForCollapsedState: [TimeInterval] = []
|
||||
|
||||
func durationSequence(_ type: AnimationType) -> [TimeInterval] {
|
||||
var durations = [TimeInterval]()
|
||||
for i in 0 ..< itemCount - 1 {
|
||||
let duration = animationDuration(i, type: type)
|
||||
durations.append(TimeInterval(duration / 2.0))
|
||||
durations.append(TimeInterval(duration / 2.0))
|
||||
}
|
||||
return durations
|
||||
}
|
||||
|
||||
func openAnimation(_ completion: (() -> Void)?) {
|
||||
isUnfolded = true
|
||||
removeImageItemsFromAnimationView()
|
||||
addImageItemsToAnimationView()
|
||||
|
||||
animationView?.alpha = 1
|
||||
containerView.alpha = 0
|
||||
|
||||
let durations = durationSequence(.open)
|
||||
|
||||
var delay: TimeInterval = 0
|
||||
var timing = convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeIn)
|
||||
var from: CGFloat = 0.0
|
||||
var to: CGFloat = -CGFloat.pi / 2
|
||||
var hidden = true
|
||||
configureAnimationItems(.open)
|
||||
|
||||
guard let animationItemViews = self.animationItemViews else {
|
||||
return
|
||||
}
|
||||
|
||||
for index in 0 ..< animationItemViews.count {
|
||||
let animatedView = animationItemViews[index]
|
||||
|
||||
animatedView.foldingAnimation(timing, from: from, to: to, duration: durations[index], delay: delay, hidden: hidden)
|
||||
|
||||
from = from == 0.0 ? CGFloat.pi / 2 : 0.0
|
||||
to = to == 0.0 ? -CGFloat.pi / 2 : 0.0
|
||||
timing = timing == convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeIn) ? convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeOut) : convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeIn)
|
||||
hidden = !hidden
|
||||
delay += durations[index]
|
||||
}
|
||||
|
||||
let firstItemView = animationView?.subviews.filter { $0.tag == 0 }.first
|
||||
|
||||
firstItemView?.layer.masksToBounds = true
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + durations[0], execute: {
|
||||
firstItemView?.layer.cornerRadius = 0
|
||||
})
|
||||
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
|
||||
self.animationView?.alpha = 0
|
||||
self.containerView.alpha = 1
|
||||
completion?()
|
||||
}
|
||||
}
|
||||
|
||||
func closeAnimation(_ completion: (() -> Void)?) {
|
||||
isUnfolded = false
|
||||
removeImageItemsFromAnimationView()
|
||||
addImageItemsToAnimationView()
|
||||
|
||||
guard let animationItemViews = self.animationItemViews else {
|
||||
fatalError()
|
||||
}
|
||||
|
||||
animationView?.alpha = 1
|
||||
containerView.alpha = 0
|
||||
|
||||
var durations: [TimeInterval] = durationSequence(.close).reversed()
|
||||
|
||||
var delay: TimeInterval = 0
|
||||
var timing = convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeIn)
|
||||
var from: CGFloat = 0.0
|
||||
var to: CGFloat = CGFloat.pi / 2
|
||||
var hidden = true
|
||||
configureAnimationItems(.close)
|
||||
|
||||
if durations.count < animationItemViews.count {
|
||||
fatalError("wrong override func animationDuration(itemIndex:NSInteger, type:AnimationType)-> NSTimeInterval")
|
||||
}
|
||||
for index in 0 ..< animationItemViews.count {
|
||||
let animatedView = animationItemViews.reversed()[index]
|
||||
|
||||
animatedView.foldingAnimation(timing, from: from, to: to, duration: durations[index], delay: delay, hidden: hidden)
|
||||
|
||||
to = to == 0.0 ? CGFloat.pi / 2 : 0.0
|
||||
from = from == 0.0 ? -CGFloat.pi / 2 : 0.0
|
||||
timing = timing == convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeIn) ? convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeOut) : convertFromCAMediaTimingFunctionName(CAMediaTimingFunctionName.easeIn)
|
||||
hidden = !hidden
|
||||
delay += durations[index]
|
||||
}
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + delay, execute: {
|
||||
self.animationView?.alpha = 0
|
||||
completion?()
|
||||
})
|
||||
|
||||
let firstItemView = animationView?.subviews.filter { $0.tag == 0 }.first
|
||||
firstItemView?.layer.cornerRadius = 0
|
||||
firstItemView?.layer.masksToBounds = true
|
||||
if let durationFirst = durations.first {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + delay - durationFirst * 2, execute: {
|
||||
firstItemView?.layer.cornerRadius = self.foregroundView.layer.cornerRadius
|
||||
firstItemView?.setNeedsDisplay()
|
||||
firstItemView?.setNeedsLayout()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: RotatedView
|
||||
open class RotatedView: UIView {
|
||||
var hiddenAfterAnimation = false
|
||||
var backView: RotatedView?
|
||||
|
||||
func addBackView(_ height: CGFloat, color:UIColor) {
|
||||
let view = RotatedView(frame: CGRect.zero)
|
||||
view.backgroundColor = color
|
||||
view.layer.anchorPoint = CGPoint.init(x: 0.5, y: 1)
|
||||
view.layer.transform = view.transform3d()
|
||||
view.translatesAutoresizingMaskIntoConstraints = false
|
||||
self.addSubview(view)
|
||||
backView = view
|
||||
|
||||
view.addConstraint(NSLayoutConstraint(item: view, attribute: .height, relatedBy: .equal, toItem: nil,attribute: .height,
|
||||
multiplier: 1, constant: height))
|
||||
|
||||
self.addConstraints([
|
||||
NSLayoutConstraint(item: view, attribute: .top, relatedBy: .equal, toItem: self, attribute: .top, multiplier: 1,
|
||||
constant: self.bounds.size.height - height + height / 2),
|
||||
NSLayoutConstraint(item: view, attribute: .leading, relatedBy: .equal, toItem: self, attribute: .leading,
|
||||
multiplier: 1, constant: 0),
|
||||
NSLayoutConstraint(item: view, attribute: .trailing, relatedBy: .equal, toItem: self, attribute: .trailing,
|
||||
multiplier: 1, constant: 0)
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
open class RotatedView: UIView {
|
||||
|
||||
fileprivate enum Const {
|
||||
static let rotationX = "rotation.x"
|
||||
static let transformRotationX = "transform.rotation.x"
|
||||
}
|
||||
|
||||
var hiddenAfterAnimation = false
|
||||
var backView: RotatedView?
|
||||
|
||||
func addBackView(_ height: CGFloat, color: UIColor) {
|
||||
let view = RotatedView(frame: CGRect.zero)
|
||||
view.backgroundColor = color
|
||||
view.layer.anchorPoint = CGPoint(x: 0.5, y: 1)
|
||||
view.layer.transform = view.transform3d()
|
||||
view.translatesAutoresizingMaskIntoConstraints = false
|
||||
self.addSubview(view)
|
||||
backView = view
|
||||
|
||||
view.addConstraint(NSLayoutConstraint(item: view, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .height,
|
||||
multiplier: 1, constant: height))
|
||||
|
||||
self.addConstraints([
|
||||
NSLayoutConstraint(item: view, attribute: .top, relatedBy: .equal, toItem: self, attribute: .top, multiplier: 1,
|
||||
constant: self.bounds.size.height - height + height / 2),
|
||||
NSLayoutConstraint(item: view, attribute: .leading, relatedBy: .equal, toItem: self, attribute: .leading,
|
||||
multiplier: 1, constant: 0),
|
||||
NSLayoutConstraint(item: view, attribute: .trailing, relatedBy: .equal, toItem: self, attribute: .trailing,
|
||||
multiplier: 1, constant: 0),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
extension RotatedView: CAAnimationDelegate {
|
||||
|
||||
func rotatedX(_ angle : CGFloat) {
|
||||
var allTransofrom = CATransform3DIdentity;
|
||||
let rotateTransform = CATransform3DMakeRotation(angle, 1, 0, 0)
|
||||
allTransofrom = CATransform3DConcat(allTransofrom, rotateTransform)
|
||||
allTransofrom = CATransform3DConcat(allTransofrom, transform3d())
|
||||
self.layer.transform = allTransofrom
|
||||
}
|
||||
|
||||
func transform3d() -> CATransform3D {
|
||||
var transform = CATransform3DIdentity
|
||||
transform.m34 = 2.5 / -2000;
|
||||
return transform
|
||||
}
|
||||
|
||||
// MARK: animations
|
||||
func foldingAnimation(_ timing: String, from: CGFloat, to: CGFloat, duration: TimeInterval, delay:TimeInterval, hidden:Bool) {
|
||||
|
||||
let rotateAnimation = CABasicAnimation(keyPath: "transform.rotation.x")
|
||||
rotateAnimation.timingFunction = CAMediaTimingFunction(name: timing)
|
||||
rotateAnimation.fromValue = (from)
|
||||
rotateAnimation.toValue = (to)
|
||||
rotateAnimation.duration = duration
|
||||
rotateAnimation.delegate = self;
|
||||
rotateAnimation.fillMode = kCAFillModeForwards
|
||||
rotateAnimation.isRemovedOnCompletion = false;
|
||||
rotateAnimation.beginTime = CACurrentMediaTime() + delay
|
||||
func rotatedX(_ angle: CGFloat) {
|
||||
var allTransofrom = CATransform3DIdentity
|
||||
let rotateTransform = CATransform3DMakeRotation(angle, 1, 0, 0)
|
||||
allTransofrom = CATransform3DConcat(allTransofrom, rotateTransform)
|
||||
allTransofrom = CATransform3DConcat(allTransofrom, transform3d())
|
||||
self.layer.transform = allTransofrom
|
||||
}
|
||||
|
||||
self.hiddenAfterAnimation = hidden
|
||||
func transform3d() -> CATransform3D {
|
||||
var transform = CATransform3DIdentity
|
||||
transform.m34 = 2.5 / -2000
|
||||
return transform
|
||||
}
|
||||
|
||||
self.layer.add(rotateAnimation, forKey: "rotation.x")
|
||||
}
|
||||
|
||||
public func animationDidStart(_ anim: CAAnimation) {
|
||||
self.layer.shouldRasterize = true
|
||||
self.alpha = 1
|
||||
}
|
||||
|
||||
public func animationDidStop(_ anim: CAAnimation, finished flag: Bool) {
|
||||
if hiddenAfterAnimation {
|
||||
self.alpha = 0
|
||||
// MARK: animations
|
||||
|
||||
func foldingAnimation(_ timing: String, from: CGFloat, to: CGFloat, duration: TimeInterval, delay: TimeInterval, hidden: Bool) {
|
||||
|
||||
let rotateAnimation = CABasicAnimation(keyPath: Const.transformRotationX)
|
||||
rotateAnimation.timingFunction = CAMediaTimingFunction(name: convertToCAMediaTimingFunctionName(timing))
|
||||
rotateAnimation.fromValue = from
|
||||
rotateAnimation.toValue = to
|
||||
rotateAnimation.duration = duration
|
||||
rotateAnimation.delegate = self
|
||||
rotateAnimation.fillMode = CAMediaTimingFillMode.forwards
|
||||
rotateAnimation.isRemovedOnCompletion = false
|
||||
rotateAnimation.beginTime = CACurrentMediaTime() + delay
|
||||
|
||||
self.hiddenAfterAnimation = hidden
|
||||
|
||||
self.layer.add(rotateAnimation, forKey: Const.rotationX)
|
||||
}
|
||||
|
||||
public func animationDidStart(_: CAAnimation) {
|
||||
self.layer.shouldRasterize = true
|
||||
self.alpha = 1
|
||||
}
|
||||
|
||||
public func animationDidStop(_: CAAnimation, finished _: Bool) {
|
||||
if hiddenAfterAnimation {
|
||||
self.alpha = 0
|
||||
}
|
||||
self.layer.removeAllAnimations()
|
||||
self.layer.shouldRasterize = false
|
||||
self.rotatedX(CGFloat(0))
|
||||
}
|
||||
self.layer.removeAllAnimations()
|
||||
self.layer.shouldRasterize = false
|
||||
self.rotatedX(CGFloat(0))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: UIView + extension
|
||||
private extension UIView {
|
||||
|
||||
func pb_takeSnapshot(_ frame: CGRect) -> UIImage? {
|
||||
UIGraphicsBeginImageContextWithOptions(frame.size, false, 0)
|
||||
|
||||
guard let context = UIGraphicsGetCurrentContext() else { return nil }
|
||||
context.translateBy(x: frame.origin.x * -1, y: frame.origin.y * -1)
|
||||
|
||||
layer.render(in: context)
|
||||
let image = UIGraphicsGetImageFromCurrentImageContext()
|
||||
UIGraphicsEndImageContext()
|
||||
|
||||
return image
|
||||
}
|
||||
|
||||
func takeSnapshot(_ frame: CGRect) -> UIImage? {
|
||||
UIGraphicsBeginImageContextWithOptions(frame.size, false, 0)
|
||||
|
||||
guard let context = UIGraphicsGetCurrentContext() else { return nil }
|
||||
context.translateBy(x: frame.origin.x * -1, y: frame.origin.y * -1)
|
||||
|
||||
layer.render(in: context)
|
||||
let image = UIGraphicsGetImageFromCurrentImageContext()
|
||||
UIGraphicsEndImageContext()
|
||||
|
||||
return image
|
||||
}
|
||||
}
|
||||
|
||||
// Helper function inserted by Swift 4.2 migrator.
|
||||
fileprivate func convertFromCAMediaTimingFunctionName(_ input: CAMediaTimingFunctionName) -> String {
|
||||
return input.rawValue
|
||||
}
|
||||
|
||||
// Helper function inserted by Swift 4.2 migrator.
|
||||
fileprivate func convertToCAMediaTimingFunctionName(_ input: String) -> CAMediaTimingFunctionName {
|
||||
return CAMediaTimingFunctionName(rawValue: input)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// FoldingCellDemoTests.swift
|
||||
// FoldingCellDemoTests
|
||||
//
|
||||
// Created by Alex K on 06/09/2018.
|
||||
// Copyright © 2018 Alex K. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import UIKit
|
||||
@testable import FoldingCell
|
||||
@testable import FoldingCell_Demo
|
||||
|
||||
class FoldingCellDemoTests: XCTestCase {
|
||||
|
||||
var foldingCell: FoldingCell!
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
let storyboard = UIStoryboard(name: "Main", bundle: nil)
|
||||
let vc = storyboard.instantiateViewController(withIdentifier: "MainTableViewController") as! MainTableViewController
|
||||
_ = vc.view
|
||||
foldingCell = vc.tableView.dequeueReusableCell(withIdentifier: "FoldingCell", for: IndexPath(row: 0, section: 0)) as? FoldingCell
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testCreateFoldingCell() {
|
||||
XCTAssertNotNil(foldingCell)
|
||||
}
|
||||
|
||||
func testUnfold() {
|
||||
XCTAssertEqual(foldingCell.isUnfolded, false)
|
||||
foldingCell.unfold(true)
|
||||
XCTAssertEqual(foldingCell.isUnfolded, true)
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
@@ -16,8 +16,6 @@
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
@@ -1,45 +0,0 @@
|
||||
//
|
||||
// FoldingCellTests.swift
|
||||
// FoldingCellTests
|
||||
//
|
||||
// Created by Alex K. on 25/01/16.
|
||||
// Copyright © 2016 Alex K. All rights reserved.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
|
||||
class FoldingCellTests: XCTestCase {
|
||||
|
||||
var viewController : UITableViewController!
|
||||
|
||||
override func setUp() {
|
||||
super.setUp()
|
||||
|
||||
let storyboard = UIStoryboard(name: "Main", bundle: nil)
|
||||
viewController = storyboard.instantiateViewController(withIdentifier: "MainTableViewController") as! UITableViewController
|
||||
viewController.beginAppearanceTransition(true, animated: false)
|
||||
}
|
||||
|
||||
override func tearDown() {
|
||||
viewController.endAppearanceTransition()
|
||||
super.tearDown()
|
||||
}
|
||||
|
||||
func testExample() {
|
||||
let tableView = viewController.tableView
|
||||
|
||||
for case let cell as FoldingCell in (tableView?.visibleCells)! {
|
||||
XCTAssertTrue(cell.itemCount >= 2)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
func testPerformanceExample() {
|
||||
// This is an example of a performance test case.
|
||||
self.measure {
|
||||
// Put the code you want to measure the time of here.
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,34 +1,35 @@
|
||||
[](https://business.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=foolding-cell-logo)
|
||||

|
||||
<img src="https://github.com/Ramotion/folding-cell/blob/master/Screenshots/foldingCell.gif" width="600" height="450" /></a>
|
||||
<br><br/>
|
||||
|
||||
# FoldingCell
|
||||
[](https://cocoapods.org/pods/FoldingCell)
|
||||
[](http://cocoapods.org/pods/FoldingCell)
|
||||
[](https://cdn.rawgit.com/Ramotion/folding-cell/master/docs/index.html)
|
||||
[](https://github.com/Ramotion/folding-cell)
|
||||
[](http://twitter.com/Ramotion)
|
||||
[](https://travis-ci.org/Ramotion/folding-cell)
|
||||
[](https://codebeat.co/projects/github-com-ramotion-folding-cell)
|
||||
[](https://github.com/Carthage/Carthage)
|
||||
[](https://developer.apple.com/swift/)
|
||||
[](https://github.com/igrigorik/ga-beacon)
|
||||
[](https://paypal.me/Ramotion)
|
||||
|
||||
## About
|
||||
This project is maintained by Ramotion, Inc.<br>
|
||||
We specialize in the designing and coding of custom UI for Mobile Apps and Websites.<br><br>**Looking for developers for your project?**
|
||||
# Check this library on other platforms:
|
||||
<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>
|
||||
|
||||
<a href="https://business.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=foolding-cell-contact-us/#Get_in_Touch" > <img src="https://github.com/Ramotion/navigation-stack/raw/master/contact_our_team@2x.png" width="150" height="30"></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.
|
||||
|
||||
[](https://dribbble.com/shots/2121350-Delivery-Card)
|
||||
<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).
|
||||
|
||||
## Try this UI control in action
|
||||
|
||||
<a href="https://itunes.apple.com/app/apple-store/id1182360240?pt=550053&ct=gthb-folding-cell&mt=8" > <img src="https://github.com/Ramotion/navigation-stack/raw/master/Download_on_the_App_Store_Badge_US-UK_135x40.png" width="170" height="58"></a>
|
||||
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
|
||||
|
||||
- iOS 8.0+
|
||||
- Xcode 7.3
|
||||
- Xcode 9.0+
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -36,7 +37,7 @@ Just add the FoldingCell.swift file to your project.
|
||||
|
||||
or use [CocoaPods](https://cocoapods.org) with Podfile:
|
||||
```
|
||||
pod 'FoldingCell', '~> 2.0.3'
|
||||
pod 'FoldingCell'
|
||||
```
|
||||
or [Carthage](https://github.com/Carthage/Carthage) users can simply add Mantle to their `Cartfile`:
|
||||
```
|
||||
@@ -73,7 +74,6 @@ Your result should be something like this picture:
|
||||
|
||||

|
||||
|
||||
[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
|
||||
|
||||
@@ -111,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
|
||||
@@ -151,8 +151,7 @@ fileprivate struct C {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### if don't use storyboard and xib files
|
||||
## if don't use storyboard and xib files
|
||||
|
||||
Create foregroundView and containerView from code (steps 2 - 3) look example:
|
||||
[Folding-cell-programmatically](https://github.com/ober01/Folding-cell-programmatically)
|
||||
@@ -162,8 +161,19 @@ Create foregroundView and containerView from code (steps 2 - 3) look example:
|
||||
Folding cell is released under the MIT license.
|
||||
See [LICENSE](./LICENSE) for details.
|
||||
|
||||
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>
|
||||
|
||||
## Follow Us
|
||||
# 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.
|
||||
|
||||
[](https://twitter.com/intent/tweet?text=https://github.com/ramotion/foolding-cell)
|
||||
[](https://twitter.com/ramotion)
|
||||
<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="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 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 |
Reference in New Issue
Block a user