Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7922cda3b4 | ||
|
|
69624db27e | ||
|
|
e4f3ca0679 | ||
|
|
5f123c4959 | ||
|
|
a230b36692 | ||
|
|
53e9769d0f | ||
|
|
fdf5c80e3b | ||
|
|
205858f47a | ||
|
|
3e797cdc81 | ||
|
|
8860d73fd5 | ||
|
|
bafc060fd6 | ||
|
|
859594d109 | ||
|
|
ecf7e8e2ac | ||
|
|
b3b7587bef | ||
|
|
45f049e8ec | ||
|
|
c273ba5391 | ||
|
|
f09bbfeae1 | ||
|
|
24ed0e45bf | ||
|
|
b4f58a6a93 | ||
|
|
7669c351ad | ||
|
|
4700abe592 | ||
|
|
d9f5c150eb | ||
|
|
0c58f5e080 | ||
|
|
3c79be98e7 | ||
|
|
97fa1822cd | ||
|
|
4122c59772 | ||
|
|
a6c6c6ba66 |
@@ -0,0 +1,12 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'FoldingCell'
|
||||
s.version = '0.2'
|
||||
s.summary = 'UITableViewCell with folding animation.'
|
||||
s.homepage = 'https://github.com/Ramotion/folding-cell'
|
||||
s.license = 'MIT'
|
||||
s.authors = { 'Juri Vasylenko' => 'juri.v@ramotion.com' }
|
||||
s.ios.deployment_target = '8.0'
|
||||
s.source = { :git => 'https://github.com/Ramotion/folding-cell.git', :tag => s.version.to_s }
|
||||
s.source_files = 'FoldingCell/FoldingCell/FoldingCell/*.swift'
|
||||
s.requires_arc = true
|
||||
end
|
||||
@@ -26,7 +26,22 @@
|
||||
84CDB15A1C2D416400FCD7C8 /* DemoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84CDB1591C2D416400FCD7C8 /* DemoCell.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
840B98551C33FE660081B926 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
840B984B1C33FE660081B926 /* FoldingCellFramework.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FoldingCellFramework.h; sourceTree = "<group>"; };
|
||||
840B984D1C33FE660081B926 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
847A58041C294F750028FB84 /* FoldingCell.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FoldingCell.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
847A58071C294F750028FB84 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
847A580C1C294F750028FB84 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
@@ -59,10 +74,20 @@
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
840B984A1C33FE660081B926 /* FoldingCellFramework */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
840B984B1C33FE660081B926 /* FoldingCellFramework.h */,
|
||||
840B984D1C33FE660081B926 /* Info.plist */,
|
||||
);
|
||||
path = FoldingCellFramework;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
847A57FB1C294F750028FB84 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
847A58061C294F750028FB84 /* FoldingCell */,
|
||||
840B984A1C33FE660081B926 /* FoldingCellFramework */,
|
||||
847A58051C294F750028FB84 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
@@ -126,6 +151,7 @@
|
||||
847A58001C294F750028FB84 /* Sources */,
|
||||
847A58011C294F750028FB84 /* Frameworks */,
|
||||
847A58021C294F750028FB84 /* Resources */,
|
||||
840B98551C33FE660081B926 /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -311,6 +337,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
|
||||
INFOPLIST_FILE = FoldingCell/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
@@ -323,6 +350,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
|
||||
INFOPLIST_FILE = FoldingCell/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0720"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
<BuildActionEntries>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "840B98481C33FE660081B926"
|
||||
BuildableName = "FoldingCellFramework.framework"
|
||||
BlueprintName = "FoldingCellFramework"
|
||||
ReferencedContainer = "container:FoldingCell.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
</BuildActionEntries>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
launchStyle = "0"
|
||||
useCustomWorkingDirectory = "NO"
|
||||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "840B98481C33FE660081B926"
|
||||
BuildableName = "FoldingCellFramework.framework"
|
||||
BlueprintName = "FoldingCellFramework"
|
||||
ReferencedContainer = "container:FoldingCell.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "840B98481C33FE660081B926"
|
||||
BuildableName = "FoldingCellFramework.framework"
|
||||
BlueprintName = "FoldingCellFramework"
|
||||
ReferencedContainer = "container:FoldingCell.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
||||
@@ -71,19 +71,19 @@
|
||||
<rect key="frame" x="0.0" y="0.0" width="88" height="165"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="£25" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uWG-zH-Vjo">
|
||||
<rect key="frame" x="20" y="34" width="41" height="28"/>
|
||||
<rect key="frame" x="19" y="31" width="42" height="33"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans-Light" family="Open Sans" pointSize="24"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="0.8008604307432432" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="TODAY" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="FQM-r1-a67">
|
||||
<rect key="frame" x="18" y="103" width="33" height="12"/>
|
||||
<rect key="frame" x="18" y="101" width="32" height="14"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="10"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="0.5" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="06:30 PM" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9ka-ho-kkM">
|
||||
<rect key="frame" x="18" y="121" width="56" height="16"/>
|
||||
<rect key="frame" x="18" y="119" width="57" height="18"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="13"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="0.80434438344594594" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -115,13 +115,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="17"/>
|
||||
<rect key="frame" x="124" y="28" width="426" height="20"/>
|
||||
<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="calibratedRGB"/>
|
||||
<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="17"/>
|
||||
<rect key="frame" x="124" y="57" width="426" height="20"/>
|
||||
<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="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -130,13 +130,13 @@
|
||||
<rect key="frame" x="410" y="100" width="150" height="40"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="WEIGHT" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dKi-6r-6NP">
|
||||
<rect key="frame" x="0.0" y="0.0" width="39" height="12"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="38" height="14"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="10"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.23921568630000001" blue="0.26274509800000001" alpha="0.5" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="light" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fZc-Gv-4xg">
|
||||
<rect key="frame" x="0.0" y="19" width="35" height="21"/>
|
||||
<rect key="frame" x="0.0" y="15" width="39" height="25"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans-Semibold" family="Open Sans" pointSize="18"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.23921568630000001" blue="0.26274509800000001" alpha="0.5" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -154,13 +154,13 @@
|
||||
<rect key="frame" x="259" y="100" width="150" height="40"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PLEDGE" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="O5e-nR-iJW">
|
||||
<rect key="frame" x="0.0" y="0.0" width="39" height="12"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="37" height="14"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="10"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.23921568630000001" blue="0.26274509800000001" alpha="0.5" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="$150" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="a0P-Eh-vI9">
|
||||
<rect key="frame" x="0.0" y="19" width="41" height="21"/>
|
||||
<rect key="frame" x="0.0" y="15" width="42" height="25"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans-Semibold" family="Open Sans" pointSize="18"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.23921568630000001" blue="0.26274509800000001" alpha="0.5" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -178,13 +178,13 @@
|
||||
<rect key="frame" x="108" y="100" width="150" height="40"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="REQUESTS" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="X8Y-jq-qbv">
|
||||
<rect key="frame" x="0.0" y="0.0" width="53" height="12"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="49" height="14"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="10"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.23921568627450979" blue="0.2627450980392157" alpha="0.5" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sA6-bX-nDC">
|
||||
<rect key="frame" x="0.0" y="19" width="11" height="21"/>
|
||||
<rect key="frame" x="0.0" y="15" width="11" height="25"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans-Semibold" family="Open Sans" pointSize="18"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.23921568630000001" blue="0.26274509800000001" alpha="0.5" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -282,13 +282,13 @@
|
||||
<rect key="frame" x="10" y="117" width="179" height="40"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="REQUESTS" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qOA-jB-5OO">
|
||||
<rect key="frame" x="0.0" y="0.0" width="53" height="12"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="49" height="14"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="10"/>
|
||||
<color key="textColor" white="1" alpha="0.5" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="2" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="S4b-sI-0J6">
|
||||
<rect key="frame" x="0.0" y="19" width="11" height="21"/>
|
||||
<rect key="frame" x="0.0" y="15" width="11" height="25"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans-Semibold" family="Open Sans" pointSize="18"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -307,13 +307,13 @@
|
||||
<rect key="frame" x="190" y="117" width="180" height="40"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="PLEDGE" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4DJ-Tz-dlt">
|
||||
<rect key="frame" x="71" y="0.0" width="39" height="12"/>
|
||||
<rect key="frame" x="72" y="0.0" width="37" height="14"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="10"/>
|
||||
<color key="textColor" white="1" alpha="0.5" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="$150" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DwZ-qm-hHf">
|
||||
<rect key="frame" x="70" y="19" width="41" height="21"/>
|
||||
<rect key="frame" x="69" y="15" width="42" height="25"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans-Semibold" family="Open Sans" pointSize="18"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -331,13 +331,13 @@
|
||||
<rect key="frame" x="371" y="117" width="179" height="40"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="WEIGHT" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8pV-vb-qIN">
|
||||
<rect key="frame" x="140" y="0.0" width="39" height="12"/>
|
||||
<rect key="frame" x="141" y="0.0" width="38" height="14"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="10"/>
|
||||
<color key="textColor" white="1" alpha="0.5" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="light" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="R9w-bP-fWa">
|
||||
<rect key="frame" x="144" y="19" width="35" height="21"/>
|
||||
<rect key="frame" x="140" y="15" width="39" height="25"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans-Semibold" family="Open Sans" pointSize="18"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -379,19 +379,19 @@
|
||||
<rect key="frame" x="0.0" y="165" width="560" height="165"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SENDER" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="W63-7b-X8w">
|
||||
<rect key="frame" x="22" y="11" width="40" height="12"/>
|
||||
<rect key="frame" x="22" y="9" width="38" height="14"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="10"/>
|
||||
<color key="textColor" red="0.13725490196078433" green="0.13725490196078433" blue="0.13725490196078433" alpha="0.49546030405405406" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Edward Norton" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ax5-gv-o7S">
|
||||
<rect key="frame" x="79" y="28" width="473" height="18"/>
|
||||
<rect key="frame" x="79" y="28" width="473" height="21"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans-Semibold" family="Open Sans" pointSize="15"/>
|
||||
<color key="textColor" red="0.20392156862745098" green="0.23921568627450979" blue="0.2627450980392157" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="stars" translatesAutoresizingMaskIntoConstraints="NO" id="DCW-h4-xYV">
|
||||
<rect key="frame" x="79" y="51" width="97" height="17"/>
|
||||
<rect key="frame" x="79" y="54" width="97" height="17"/>
|
||||
</imageView>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="photo" translatesAutoresizingMaskIntoConstraints="NO" id="Nm8-JU-yEj" userLabel="photo">
|
||||
<rect key="frame" x="22" y="28" width="49" height="49"/>
|
||||
@@ -414,19 +414,19 @@
|
||||
<rect key="frame" x="22" y="92" width="258" height="73"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="FROM" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mrt-du-GX9">
|
||||
<rect key="frame" x="0.0" y="8" width="248" height="12"/>
|
||||
<rect key="frame" x="0.0" y="8" width="248" height="14"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="10"/>
|
||||
<color key="textColor" red="0.13725490200000001" green="0.13725490200000001" blue="0.13725490200000001" alpha="0.49546030410000003" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="W 90th St" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="I2n-ts-cGO">
|
||||
<rect key="frame" x="0.0" y="24" width="248" height="18"/>
|
||||
<rect key="frame" x="0.0" y="26" width="248" height="21"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans-Semibold" family="Open Sans" pointSize="15"/>
|
||||
<color key="textColor" red="0.20392156859999999" green="0.23921568630000001" blue="0.26274509800000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="New York, NY 10025" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VHi-qF-ipj">
|
||||
<rect key="frame" x="0.0" y="42" width="248" height="14"/>
|
||||
<rect key="frame" x="0.0" y="47" width="248" height="17"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="12"/>
|
||||
<color key="textColor" red="0.20392156859999999" green="0.23921568630000001" blue="0.26274509800000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -449,19 +449,19 @@
|
||||
<rect key="frame" x="281" y="92" width="257" height="73"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="TO" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sel-qV-TVo">
|
||||
<rect key="frame" x="0.0" y="8" width="257" height="12"/>
|
||||
<rect key="frame" x="0.0" y="8" width="257" height="14"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="10"/>
|
||||
<color key="textColor" red="0.13725490200000001" green="0.13725490200000001" blue="0.13725490200000001" alpha="0.49546030410000003" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="46th Ave" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="AOk-eM-O1f">
|
||||
<rect key="frame" x="0.0" y="24" width="257" height="18"/>
|
||||
<rect key="frame" x="0.0" y="26" width="257" height="21"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans-Semibold" family="Open Sans" pointSize="15"/>
|
||||
<color key="textColor" red="0.20392156859999999" green="0.23921568630000001" blue="0.26274509800000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Woodside, NY 11101" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7sP-u0-3Jz">
|
||||
<rect key="frame" x="0.0" y="42" width="257" height="14"/>
|
||||
<rect key="frame" x="0.0" y="47" width="257" height="17"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="12"/>
|
||||
<color key="textColor" red="0.20392156859999999" green="0.23921568630000001" blue="0.26274509800000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -525,19 +525,19 @@
|
||||
<rect key="frame" x="22" y="0.0" width="257" height="73"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="DELIVERY DATE" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Gqh-Lu-0yL">
|
||||
<rect key="frame" x="0.0" y="8" width="247" height="12"/>
|
||||
<rect key="frame" x="0.0" y="8" width="247" height="14"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="10"/>
|
||||
<color key="textColor" red="0.13725490200000001" green="0.13725490200000001" blue="0.13725490200000001" alpha="0.49546030410000003" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="06:30 pm" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3Nd-1K-xsW">
|
||||
<rect key="frame" x="0.0" y="24" width="247" height="18"/>
|
||||
<rect key="frame" x="0.0" y="26" width="247" height="21"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans-Semibold" family="Open Sans" pointSize="15"/>
|
||||
<color key="textColor" red="0.20392156859999999" green="0.23921568630000001" blue="0.26274509800000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="May 16, 2015" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CVH-a0-dOK">
|
||||
<rect key="frame" x="0.0" y="42" width="247" height="14"/>
|
||||
<rect key="frame" x="0.0" y="47" width="247" height="17"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="12"/>
|
||||
<color key="textColor" red="0.20392156859999999" green="0.23921568630000001" blue="0.26274509800000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -560,13 +560,13 @@
|
||||
<rect key="frame" x="282" y="0.0" width="256" height="73"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="REQUEST DEADLINE" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GYY-Sq-cIe">
|
||||
<rect key="frame" x="0.0" y="8" width="256" height="12"/>
|
||||
<rect key="frame" x="0.0" y="8" width="256" height="14"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans" family="Open Sans" pointSize="10"/>
|
||||
<color key="textColor" red="0.13725490200000001" green="0.13725490200000001" blue="0.13725490200000001" alpha="0.49546030410000003" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="24 minutes" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mgx-5V-Xba">
|
||||
<rect key="frame" x="0.0" y="24" width="256" height="18"/>
|
||||
<rect key="frame" x="0.0" y="26" width="256" height="21"/>
|
||||
<fontDescription key="fontDescription" name="OpenSans-Semibold" family="Open Sans" pointSize="15"/>
|
||||
<color key="textColor" red="0.20392156859999999" green="0.23921568630000001" blue="0.26274509800000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
@@ -683,6 +683,9 @@
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="backViewColor">
|
||||
<color key="value" red="0.96862745100000003" green="0.93725490199999995" blue="0.96862745100000003" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="itemCount">
|
||||
<integer key="value" value="4"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="containerView" destination="CGm-93-iX0" id="gSm-z4-RdG"/>
|
||||
|
||||
@@ -23,32 +23,36 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
class FoldingCell: UITableViewCell {
|
||||
public class FoldingCell: UITableViewCell {
|
||||
|
||||
typealias CompletionHandler = () -> Void
|
||||
public typealias CompletionHandler = () -> Void
|
||||
|
||||
@IBOutlet weak var containerView: UIView!
|
||||
@IBOutlet weak var foregroundView: RotatedView!
|
||||
var animationView: UIView?
|
||||
|
||||
@IBInspectable var itemCount: NSInteger = 2 //count of folding
|
||||
|
||||
@IBInspectable var backViewColor: UIColor = UIColor.brownColor()
|
||||
|
||||
var animationItemViews: [RotatedView]?
|
||||
|
||||
enum AnimationType {
|
||||
public enum AnimationType {
|
||||
case Open
|
||||
case Close
|
||||
}
|
||||
|
||||
// MARK: life cicle
|
||||
|
||||
override func awakeFromNib() {
|
||||
override public func awakeFromNib() {
|
||||
super.awakeFromNib()
|
||||
|
||||
configureDefaultState()
|
||||
animationItemViews = createAnimationItemView()
|
||||
|
||||
self.selectionStyle = .None
|
||||
containerView.backgroundColor = UIColor.clearColor()
|
||||
|
||||
containerView.layer.cornerRadius = foregroundView.layer.cornerRadius
|
||||
containerView.layer.masksToBounds = true
|
||||
}
|
||||
|
||||
// MARK: configure
|
||||
@@ -63,41 +67,19 @@ class FoldingCell: UITableViewCell {
|
||||
containerViewTopConstraint!.constant = foregroundTopConstraint!.constant
|
||||
containerView.alpha = 0;
|
||||
|
||||
let firstItemView = containerView.subviews.filter{$0.tag == 0}.first
|
||||
assert(firstItemView != nil, "contaner empty")
|
||||
firstItemView!.layer.cornerRadius = foregroundView.layer.cornerRadius
|
||||
|
||||
foregroundView.layer.anchorPoint = CGPoint.init(x: 0.5, y: 1)
|
||||
foregroundTopConstraint!.constant += foregroundView.bounds.height / 2
|
||||
foregroundView.layer.transform = foregroundView.transform3d()
|
||||
|
||||
createAnimationView();
|
||||
self.contentView.bringSubviewToFront(foregroundView)
|
||||
|
||||
// elements view
|
||||
|
||||
for constraint in containerView.constraints {
|
||||
if constraint.identifier == "yPosition" {
|
||||
constraint.constant -= constraint.firstItem.bounds.height / 2
|
||||
constraint.firstItem.layer.anchorPoint = CGPoint.init(x: 0.5, y: 0)
|
||||
constraint.firstItem.layer.transform = constraint.firstItem.transform3d()
|
||||
}
|
||||
}
|
||||
|
||||
// added back view
|
||||
var previusView: RotatedView?
|
||||
for contener in containerView.subviews.sort({ $0.tag < $1.tag }) {
|
||||
if contener is RotatedView && contener.tag > 0 && contener.tag < containerView.subviews.count {
|
||||
let rotatedView = contener as! RotatedView
|
||||
previusView?.addBackView(rotatedView.bounds.size.height, color: backViewColor)
|
||||
previusView = rotatedView
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func createAnimationItemView()->[RotatedView] {
|
||||
var items = [RotatedView]()
|
||||
items.append(foregroundView)
|
||||
var rotatedViews = [RotatedView]()
|
||||
for itemView in containerView.subviews.filter({$0 is RotatedView}).sort({ $0.tag < $1.tag }) as! [RotatedView] {
|
||||
for itemView in animationView!.subviews.filter({$0 is RotatedView}).sort({ $0.tag < $1.tag }) as! [RotatedView] {
|
||||
rotatedViews.append(itemView)
|
||||
if itemView.backView != nil {
|
||||
rotatedViews.append(itemView.backView!)
|
||||
@@ -109,11 +91,11 @@ class FoldingCell: UITableViewCell {
|
||||
|
||||
func configureAnimationItems(animationType: AnimationType) {
|
||||
if animationType == .Open {
|
||||
for view in containerView.subviews.filter({$0 is RotatedView}) {
|
||||
for view in animationView!.subviews.filter({$0 is RotatedView}) {
|
||||
view.alpha = 0;
|
||||
}
|
||||
} else { // close
|
||||
for view: RotatedView in containerView.subviews.filter({$0 is RotatedView}) as! [RotatedView] {
|
||||
for view: RotatedView in animationView!.subviews.filter({$0 is RotatedView}) as! [RotatedView] {
|
||||
if animationType == .Open {
|
||||
view.alpha = 0
|
||||
} else {
|
||||
@@ -124,26 +106,155 @@ class FoldingCell: UITableViewCell {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: public
|
||||
|
||||
func selectedAnimation(isSelected: Bool, animated: Bool, completion: CompletionHandler?) {
|
||||
if isSelected {
|
||||
containerView.alpha = 1;
|
||||
for subview in containerView.subviews {
|
||||
subview.alpha = 1
|
||||
}
|
||||
|
||||
if animated {
|
||||
openAnimation(completion: completion)
|
||||
} else {
|
||||
foregroundView.alpha = 0
|
||||
for subview in containerView.subviews {
|
||||
if subview is RotatedView {
|
||||
let rotateView = subview as! RotatedView
|
||||
rotateView.backView?.alpha = 0
|
||||
func createAnimationView() {
|
||||
|
||||
let anAnimationView = UIView(frame: containerView.frame)
|
||||
anAnimationView.layer.cornerRadius = foregroundView.layer.cornerRadius
|
||||
anAnimationView.backgroundColor = UIColor.clearColor()
|
||||
anAnimationView.translatesAutoresizingMaskIntoConstraints = false
|
||||
self.contentView.addSubview(anAnimationView)
|
||||
|
||||
// copy constraints from containerView
|
||||
var newConstraints = [NSLayoutConstraint]()
|
||||
for constraint in self.contentView.constraints {
|
||||
if let item: UIView = constraint.firstItem as? UIView {
|
||||
if item == containerView {
|
||||
let newConstraint = NSLayoutConstraint(
|
||||
item: anAnimationView,
|
||||
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 {
|
||||
if item == containerView {
|
||||
let newConstraint = NSLayoutConstraint(
|
||||
item: constraint.firstItem,
|
||||
attribute: constraint.firstAttribute,
|
||||
relatedBy: constraint.relation,
|
||||
toItem: anAnimationView,
|
||||
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 newConstraint = NSLayoutConstraint(
|
||||
item: anAnimationView,
|
||||
attribute: constraint.firstAttribute,
|
||||
relatedBy: constraint.relation,
|
||||
toItem: nil,
|
||||
attribute: constraint.secondAttribute,
|
||||
multiplier: constraint.multiplier,
|
||||
constant: constraint.constant)
|
||||
|
||||
anAnimationView.addConstraint(newConstraint)
|
||||
}
|
||||
}
|
||||
|
||||
animationView = anAnimationView
|
||||
}
|
||||
|
||||
func addImageItemsToAnimationView() {
|
||||
containerView.alpha = 1;
|
||||
|
||||
// added first item
|
||||
var image = containerView.pb_takeSnapshot(CGRect(x: 0, y: 0, width: containerView.bounds.size.width, height: foregroundView.bounds.size.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: foregroundView.bounds.size.height,
|
||||
width: containerView.bounds.size.width,
|
||||
height: foregroundView.bounds.size.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: foregroundView.bounds.size.height,
|
||||
width: containerView.bounds.size.width,
|
||||
height: foregroundView.bounds.size.height)
|
||||
|
||||
// added other views
|
||||
let itemHeight = (containerView.bounds.size.height - 2 * foregroundView.bounds.size.height) / CGFloat(itemCount - 2)
|
||||
|
||||
if itemCount == 2 {
|
||||
// decrease containerView height or increase itemCount
|
||||
assert(containerView.bounds.size.height - 2 * foregroundView.bounds.size.height == 0, "contanerView.height too high")
|
||||
}
|
||||
// decrease containerView height or increase itemCount
|
||||
assert(containerView.bounds.size.height - 2 * foregroundView.bounds.size.height >= itemHeight, "contanerView.height too high")
|
||||
|
||||
var yPosition = 2 * foregroundView.bounds.size.height
|
||||
var tag = 2
|
||||
for var index = 2; index < itemCount; index++ {
|
||||
|
||||
image = containerView.pb_takeSnapshot(CGRect(x: 0, y: yPosition, width: containerView.bounds.size.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++;
|
||||
}
|
||||
|
||||
containerView.alpha = 0;
|
||||
|
||||
// added back view
|
||||
var previusView: RotatedView?
|
||||
for contener in animationView!.subviews.sort({ $0.tag < $1.tag }) {
|
||||
if contener is RotatedView && contener.tag > 0 && contener.tag < animationView!.subviews.count {
|
||||
let rotatedView = contener as! RotatedView
|
||||
previusView?.addBackView(rotatedView.bounds.size.height, color: backViewColor)
|
||||
previusView = rotatedView
|
||||
}
|
||||
}
|
||||
|
||||
animationItemViews = createAnimationItemView()
|
||||
}
|
||||
|
||||
// MARK: public
|
||||
|
||||
public func selectedAnimation(isSelected: Bool, animated: Bool, completion: CompletionHandler?) {
|
||||
|
||||
if isSelected {
|
||||
|
||||
if animated {
|
||||
containerView.alpha = 0;
|
||||
openAnimation(completion: completion)
|
||||
} else {
|
||||
foregroundView.alpha = 0
|
||||
containerView.alpha = 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
if animated {
|
||||
closeAnimation(completion: completion)
|
||||
@@ -154,7 +265,12 @@ class FoldingCell: UITableViewCell {
|
||||
}
|
||||
}
|
||||
|
||||
func isAnimating()->Bool {
|
||||
public func isAnimating()->Bool {
|
||||
guard animationItemViews != nil
|
||||
else {
|
||||
return false
|
||||
}
|
||||
|
||||
for item in animationItemViews! {
|
||||
if item.layer.animationKeys()?.count > 0 {
|
||||
return true
|
||||
@@ -163,16 +279,17 @@ class FoldingCell: UITableViewCell {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
// MARK: animations
|
||||
|
||||
func animationDuration(itemIndex:NSInteger, type:AnimationType)-> NSTimeInterval {
|
||||
public func animationDuration(itemIndex:NSInteger, type:AnimationType)-> NSTimeInterval {
|
||||
assert(false, "added this method to cell")
|
||||
return 0
|
||||
}
|
||||
|
||||
func durationSequence(type: AnimationType)-> [NSTimeInterval] {
|
||||
var durations = [NSTimeInterval]()
|
||||
for var index = 0; index < containerView.subviews.count - 1; index++ {
|
||||
for var index = 0; index < itemCount-1; index++ {
|
||||
let duration = animationDuration(index, type: .Open)
|
||||
durations.append(NSTimeInterval(duration / 2.0))
|
||||
durations.append(NSTimeInterval(duration / 2.0))
|
||||
@@ -182,6 +299,13 @@ class FoldingCell: UITableViewCell {
|
||||
|
||||
func openAnimation(completion completion: CompletionHandler?) {
|
||||
|
||||
if animationView?.subviews.count == 0 { // added animation items if need
|
||||
addImageItemsToAnimationView()
|
||||
}
|
||||
|
||||
animationView?.alpha = 1;
|
||||
containerView.alpha = 0;
|
||||
|
||||
let durations = durationSequence(.Open)
|
||||
|
||||
var delay: NSTimeInterval = 0
|
||||
@@ -202,18 +326,27 @@ class FoldingCell: UITableViewCell {
|
||||
delay += durations[index]
|
||||
}
|
||||
|
||||
let firstItemView = containerView.subviews.filter{$0.tag == 0}.first
|
||||
let firstItemView = animationView!.subviews.filter{$0.tag == 0}.first
|
||||
firstItemView!.layer.masksToBounds = true
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(durations[0] * Double(NSEC_PER_SEC))), dispatch_get_main_queue()) { () -> Void in
|
||||
firstItemView!.layer.masksToBounds = false
|
||||
firstItemView!.layer.cornerRadius = 0
|
||||
}
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(delay * Double(NSEC_PER_SEC))), dispatch_get_main_queue()) { () -> Void in
|
||||
self.animationView?.alpha = 0
|
||||
self.containerView.alpha = 1
|
||||
completion?()
|
||||
}
|
||||
}
|
||||
|
||||
func closeAnimation(completion completion: CompletionHandler?) {
|
||||
|
||||
if animationView?.subviews.count == 0 { // added animation items if need
|
||||
addImageItemsToAnimationView()
|
||||
}
|
||||
|
||||
animationView?.alpha = 1;
|
||||
containerView.alpha = 0;
|
||||
|
||||
var durations = durationSequence(.Close)
|
||||
durations = durations.reverse()
|
||||
|
||||
@@ -236,14 +369,14 @@ class FoldingCell: UITableViewCell {
|
||||
}
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64(delay * Double(NSEC_PER_SEC))), dispatch_get_main_queue()) { () -> Void in
|
||||
self.containerView.alpha = 0
|
||||
self.animationView!.alpha = 0
|
||||
completion?()
|
||||
}
|
||||
|
||||
let firstItemView = containerView.subviews.filter{$0.tag == 0}.first
|
||||
let firstItemView = animationView!.subviews.filter{$0.tag == 0}.first
|
||||
firstItemView!.layer.masksToBounds = false
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, Int64((delay - durations.last! * 1.5) * Double(NSEC_PER_SEC))), dispatch_get_main_queue()) { () -> Void in
|
||||
firstItemView!.layer.masksToBounds = true
|
||||
firstItemView!.layer.cornerRadius = self.foregroundView.layer.cornerRadius
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -251,7 +384,7 @@ class FoldingCell: UITableViewCell {
|
||||
|
||||
// MARK: RotatedView
|
||||
|
||||
class RotatedView: UIView {
|
||||
public class RotatedView: UIView {
|
||||
var hiddenAfterAnimation = false
|
||||
var backView: RotatedView?
|
||||
|
||||
@@ -316,12 +449,12 @@ extension RotatedView {
|
||||
self.layer.addAnimation(rotateAnimation, forKey: "rotation.x")
|
||||
}
|
||||
|
||||
override func animationDidStart(anim: CAAnimation) {
|
||||
override public func animationDidStart(anim: CAAnimation) {
|
||||
self.layer.shouldRasterize = true
|
||||
self.alpha = 1
|
||||
}
|
||||
|
||||
override func animationDidStop(anim: CAAnimation, finished flag: Bool) {
|
||||
override public func animationDidStop(anim: CAAnimation, finished flag: Bool) {
|
||||
if hiddenAfterAnimation {
|
||||
self.alpha = 0
|
||||
}
|
||||
@@ -330,3 +463,18 @@ extension RotatedView {
|
||||
self.rotatedX(CGFloat(0))
|
||||
}
|
||||
}
|
||||
|
||||
extension UIView {
|
||||
func pb_takeSnapshot(frame: CGRect) -> UIImage {
|
||||
UIGraphicsBeginImageContextWithOptions(frame.size, false, 0.0);
|
||||
|
||||
let context = UIGraphicsGetCurrentContext();
|
||||
CGContextTranslateCTM(context, frame.origin.x * -1, frame.origin.y * -1);
|
||||
|
||||
self.layer.renderInContext(UIGraphicsGetCurrentContext()!);
|
||||
let image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
UIGraphicsEndImageContext();
|
||||
|
||||
return image
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ class MainTableViewController: UITableViewController {
|
||||
|
||||
let kRowsCount = 10
|
||||
|
||||
var cellHeights: [CGFloat]?
|
||||
var cellHeights = [CGFloat]()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
@@ -41,9 +41,8 @@ class MainTableViewController: UITableViewController {
|
||||
|
||||
// MARK: configure
|
||||
func createCellHeightsArray() {
|
||||
cellHeights = Array()
|
||||
for _ in 0...kRowsCount {
|
||||
cellHeights?.append(kCloseCellHeight)
|
||||
cellHeights.append(kCloseCellHeight)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +58,7 @@ class MainTableViewController: UITableViewController {
|
||||
let foldingCell = cell as! FoldingCell
|
||||
foldingCell.backgroundColor = UIColor.clearColor()
|
||||
|
||||
if cellHeights![indexPath.row] == kCloseCellHeight {
|
||||
if cellHeights[indexPath.row] == kCloseCellHeight {
|
||||
foldingCell.selectedAnimation(false, animated: false, completion:nil)
|
||||
} else {
|
||||
foldingCell.selectedAnimation(true, animated: false, completion: nil)
|
||||
@@ -74,7 +73,7 @@ class MainTableViewController: UITableViewController {
|
||||
}
|
||||
|
||||
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
|
||||
return cellHeights![indexPath.row]
|
||||
return cellHeights[indexPath.row]
|
||||
}
|
||||
|
||||
// MARK: Table vie delegate
|
||||
@@ -88,12 +87,12 @@ class MainTableViewController: UITableViewController {
|
||||
}
|
||||
|
||||
var duration = 0.0
|
||||
if cellHeights![indexPath.row] == kCloseCellHeight { // open cell
|
||||
cellHeights![indexPath.row] = kOpenCellHeight
|
||||
if cellHeights[indexPath.row] == kCloseCellHeight { // open cell
|
||||
cellHeights[indexPath.row] = kOpenCellHeight
|
||||
cell.selectedAnimation(true, animated: true, completion: nil)
|
||||
duration = 0.5
|
||||
} else {// close cell
|
||||
cellHeights![indexPath.row] = kCloseCellHeight
|
||||
cellHeights[indexPath.row] = kCloseCellHeight
|
||||
cell.selectedAnimation(false, animated: true, completion: nil)
|
||||
duration = 1.1
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// FoldingCellFramework.h
|
||||
// FoldingCellFramework
|
||||
//
|
||||
// Created by Alex K. on 30/12/15.
|
||||
// Copyright © 2015 Alex K. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
//! Project version number for FoldingCellFramework.
|
||||
FOUNDATION_EXPORT double FoldingCellFrameworkVersionNumber;
|
||||
|
||||
//! Project version string for FoldingCellFramework.
|
||||
FOUNDATION_EXPORT const unsigned char FoldingCellFrameworkVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <FoldingCellFramework/PublicHeader.h>
|
||||
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -12,6 +12,12 @@
|
||||
|
||||
Just add the FoldingCell.swift file to your project.
|
||||
|
||||
or use [CocoaPods](https://cocoapods.org) with Podfile:
|
||||
``` ruby
|
||||
pod 'FoldingCell', '~> 0.2'
|
||||
```
|
||||
|
||||
|
||||
## Solution
|
||||

|
||||
## Usage
|
||||
@@ -37,35 +43,7 @@ property `containerView`. Add constraints from this view to the superview like i
|
||||
Your result should be something like this picture:
|
||||

|
||||
|
||||
4) Now lets add folding views
|
||||
|
||||
4.1) Add a UIView to `containerView` (where `ContainerView` is the UIView which you've added on step 3)
|
||||
Add constraints from this view to `containerView` as in the picture:
|
||||
|
||||

|
||||
|
||||
For correct animation, the height constraint constant should be equal to `foregroundView`'s height constraint constant.
|
||||
Result:
|
||||

|
||||
|
||||
4.2) Add a `UIView` to `containerView` inheriting from `RotatedView`. Add constraints from
|
||||
this view to `containerView` as in the picture:
|
||||
|
||||
.
|
||||
|
||||
For correct animation, the height constraint constant must be equal to `foregroundView`'s height constraint constant.
|
||||
Add the identifier "yPosition" for the top constraint. **The tag must be equal to 1**
|
||||
Result:
|
||||
|
||||

|
||||
|
||||
The following steps are optional (you can add as many views as you want).
|
||||
|
||||
4.3) repeat 4.2, but **increasing the tag by one**. (For the correct animation, height of the view
|
||||
must be less than or equal to that of the previous view).
|
||||
|
||||
The height of `containerView` must be equal to the sum of the heights of its subviews:
|
||||

|
||||
4) Set ``` @IBInspectable var itemCount: NSInteger ``` property is a count of folding (it IBInspectable you can set in storyborad). range 2 or greater. Default value is 2
|
||||
|
||||
Ok, we've finished configuring the cell.
|
||||
|
||||
@@ -79,7 +57,7 @@ Ok, we've finished configuring the cell.
|
||||
5.2) Add property
|
||||
|
||||
``` swift
|
||||
var cellHeights: [CGFloat]?
|
||||
var cellHeights = [CGFloat]()
|
||||
```
|
||||
|
||||
create in viewDidLoad:
|
||||
@@ -88,7 +66,7 @@ Ok, we've finished configuring the cell.
|
||||
super.viewDidLoad()
|
||||
|
||||
for _ in 0...kRowsCount {
|
||||
cellHeights?.append(kCloseCellHeight)
|
||||
cellHeights.append(kCloseCellHeight)
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -96,7 +74,7 @@ Ok, we've finished configuring the cell.
|
||||
5.3) Override method:
|
||||
``` swift
|
||||
override func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
|
||||
return cellHeights![indexPath.row]
|
||||
return cellHeights[indexPath.row]
|
||||
}
|
||||
```
|
||||
|
||||
@@ -106,12 +84,12 @@ Ok, we've finished configuring the cell.
|
||||
let cell = tableView.cellForRowAtIndexPath(indexPath) as! FoldingCell
|
||||
|
||||
var duration = 0.0
|
||||
if cellHeights![indexPath.row] == kCloseCellHeight { // open cell
|
||||
cellHeights![indexPath.row] = kOpenCellHeight
|
||||
if cellHeights[indexPath.row] == kCloseCellHeight { // open cell
|
||||
cellHeights[indexPath.row] = kOpenCellHeight
|
||||
cell.selectedAnimation(true, animated: true, completion: nil)
|
||||
duration = 0.5
|
||||
} else {// close cell
|
||||
cellHeights![indexPath.row] = kCloseCellHeight
|
||||
cellHeights[indexPath.row] = kCloseCellHeight
|
||||
cell.selectedAnimation(false, animated: true, completion: nil)
|
||||
duration = 1.1
|
||||
}
|
||||
@@ -142,7 +120,7 @@ Ok, we've finished configuring the cell.
|
||||
``` swift
|
||||
override func animationDuration(itemIndex:NSInteger, type:AnimationType)-> NSTimeInterval {
|
||||
|
||||
// durations count equal containerView.subViews.count - 1
|
||||
// durations count equal it itemCount
|
||||
let durations = [0.33, 0.26, 0.26] // timing animation for each view
|
||||
return durations[itemIndex]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user