Compare commits

..
19 Commits
Author SHA1 Message Date
Alex.k 3e797cdc81 Merge branch 'feature/regulations' into develop 2016-01-12 12:27:35 +03:00
Alex.k 8860d73fd5 added asserts 2016-01-12 12:27:28 +03:00
Alex.k bafc060fd6 added ibinspectable 2016-01-12 11:49:54 +03:00
Alex.k 859594d109 Merge branch 'feature/improves' into develop 2016-01-12 11:14:36 +03:00
Alex.k ecf7e8e2ac fixed animation 2016-01-12 11:14:14 +03:00
Alex.k b3b7587bef improve animations 2016-01-12 10:27:13 +03:00
Alex.k 45f049e8ec improve logic animation 2016-01-12 10:12:25 +03:00
Alex.k c273ba5391 added animation view 2016-01-11 18:38:19 +03:00
Alex.k f09bbfeae1 improves 2016-01-11 13:26:23 +03:00
Alex.k 24ed0e45bf remove travis file 2015-12-30 15:33:16 +03:00
Alex.k b4f58a6a93 move travis file 2015-12-30 15:29:31 +03:00
Alex.k 7669c351ad changed travis file 2015-12-30 15:09:55 +03:00
Alex.k 4700abe592 added travis file 2015-12-30 15:08:31 +03:00
Alex.k d9f5c150eb added public 2015-12-30 10:41:09 +03:00
Alex.k 0c58f5e080 Merge branch 'master' of https://github.com/Ramotion/folding-cell 2015-12-30 09:41:37 +03:00
Alex.k 3c79be98e7 shared scheme 2015-12-30 09:41:30 +03:00
Alex 97fa1822cd Update README.md 2015-12-29 16:33:42 +03:00
Alex 4122c59772 Update README.md 2015-12-29 16:31:47 +03:00
Alex.k a6c6c6ba66 added podspec 2015-12-29 16:21:13 +03:00
8 changed files with 546 additions and 92 deletions
+12
View File
@@ -0,0 +1,12 @@
Pod::Spec.new do |s|
s.name = 'FoldingCell'
s.version = '0.1'
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
@@ -7,6 +7,10 @@
objects = {
/* Begin PBXBuildFile section */
840B984C1C33FE660081B926 /* FoldingCellFramework.h in Headers */ = {isa = PBXBuildFile; fileRef = 840B984B1C33FE660081B926 /* FoldingCellFramework.h */; settings = {ATTRIBUTES = (Public, ); }; };
840B98501C33FE660081B926 /* FoldingCellFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 840B98491C33FE660081B926 /* FoldingCellFramework.framework */; };
840B98511C33FE660081B926 /* FoldingCellFramework.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 840B98491C33FE660081B926 /* FoldingCellFramework.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
840B98561C33FE730081B926 /* FoldingCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 847A581A1C294FAB0028FB84 /* FoldingCell.swift */; };
847A58081C294F750028FB84 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 847A58071C294F750028FB84 /* AppDelegate.swift */; };
847A580D1C294F750028FB84 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 847A580B1C294F750028FB84 /* Main.storyboard */; };
847A580F1C294F750028FB84 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 847A580E1C294F750028FB84 /* Assets.xcassets */; };
@@ -26,7 +30,34 @@
84CDB15A1C2D416400FCD7C8 /* DemoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84CDB1591C2D416400FCD7C8 /* DemoCell.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
840B984E1C33FE660081B926 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 847A57FC1C294F750028FB84 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 840B98481C33FE660081B926;
remoteInfo = FoldingCellFramework;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
840B98551C33FE660081B926 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
840B98511C33FE660081B926 /* FoldingCellFramework.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
840B98491C33FE660081B926 /* FoldingCellFramework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FoldingCellFramework.framework; sourceTree = BUILT_PRODUCTS_DIR; };
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>"; };
@@ -49,20 +80,38 @@
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
847A58011C294F750028FB84 /* Frameworks */ = {
840B98451C33FE660081B926 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
847A58011C294F750028FB84 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
840B98501C33FE660081B926 /* FoldingCellFramework.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* 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>";
@@ -71,6 +120,7 @@
isa = PBXGroup;
children = (
847A58041C294F750028FB84 /* FoldingCell.app */,
840B98491C33FE660081B926 /* FoldingCellFramework.framework */,
);
name = Products;
sourceTree = "<group>";
@@ -118,7 +168,36 @@
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
840B98461C33FE660081B926 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
840B984C1C33FE660081B926 /* FoldingCellFramework.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
840B98481C33FE660081B926 /* FoldingCellFramework */ = {
isa = PBXNativeTarget;
buildConfigurationList = 840B98541C33FE660081B926 /* Build configuration list for PBXNativeTarget "FoldingCellFramework" */;
buildPhases = (
840B98441C33FE660081B926 /* Sources */,
840B98451C33FE660081B926 /* Frameworks */,
840B98461C33FE660081B926 /* Headers */,
840B98471C33FE660081B926 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = FoldingCellFramework;
productName = FoldingCellFramework;
productReference = 840B98491C33FE660081B926 /* FoldingCellFramework.framework */;
productType = "com.apple.product-type.framework";
};
847A58031C294F750028FB84 /* FoldingCell */ = {
isa = PBXNativeTarget;
buildConfigurationList = 847A58161C294F750028FB84 /* Build configuration list for PBXNativeTarget "FoldingCell" */;
@@ -126,10 +205,12 @@
847A58001C294F750028FB84 /* Sources */,
847A58011C294F750028FB84 /* Frameworks */,
847A58021C294F750028FB84 /* Resources */,
840B98551C33FE660081B926 /* Embed Frameworks */,
);
buildRules = (
);
dependencies = (
840B984F1C33FE660081B926 /* PBXTargetDependency */,
);
name = FoldingCell;
productName = FoldingCell;
@@ -146,6 +227,9 @@
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = "Alex K.";
TargetAttributes = {
840B98481C33FE660081B926 = {
CreatedOnToolsVersion = 7.2;
};
847A58031C294F750028FB84 = {
CreatedOnToolsVersion = 7.2;
};
@@ -165,11 +249,19 @@
projectRoot = "";
targets = (
847A58031C294F750028FB84 /* FoldingCell */,
840B98481C33FE660081B926 /* FoldingCellFramework */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
840B98471C33FE660081B926 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
847A58021C294F750028FB84 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@@ -193,6 +285,14 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
840B98441C33FE660081B926 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
840B98561C33FE730081B926 /* FoldingCell.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
847A58001C294F750028FB84 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -206,6 +306,14 @@
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
840B984F1C33FE660081B926 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 840B98481C33FE660081B926 /* FoldingCellFramework */;
targetProxy = 840B984E1C33FE660081B926 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
847A580B1C294F750028FB84 /* Main.storyboard */ = {
isa = PBXVariantGroup;
@@ -226,6 +334,46 @@
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
840B98521C33FE660081B926 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = FoldingCellFramework/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.FoldingCellFramework;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
840B98531C33FE660081B926 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CURRENT_PROJECT_VERSION = 1;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = FoldingCellFramework/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.ramotion.FoldingCellFramework;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
847A58141C294F750028FB84 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -311,6 +459,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 +472,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";
@@ -334,6 +484,14 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
840B98541C33FE660081B926 /* Build configuration list for PBXNativeTarget "FoldingCellFramework" */ = {
isa = XCConfigurationList;
buildConfigurations = (
840B98521C33FE660081B926 /* Debug */,
840B98531C33FE660081B926 /* Release */,
);
defaultConfigurationIsVisible = 0;
};
847A57FF1C294F750028FB84 /* Build configuration list for PBXProject "FoldingCell" */ = {
isa = XCConfigurationList;
buildConfigurations = (
@@ -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,37 @@
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
@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 +68,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 +92,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 +107,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 +266,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 +280,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 +300,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 +327,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 +370,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 +385,7 @@ class FoldingCell: UITableViewCell {
// MARK: RotatedView
class RotatedView: UIView {
public class RotatedView: UIView {
var hiddenAfterAnimation = false
var backView: RotatedView?
@@ -316,12 +450,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 +464,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
}
}
@@ -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>
+7
View File
@@ -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.1'
```
## Solution
![Solution](/Tutorial-resources/Solution.png)
## Usage
@@ -46,6 +52,7 @@ 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:
![1.5](/Tutorial-resources/1.5.png)
4.2) Add a `UIView` to `containerView` inheriting from `RotatedView`. Add constraints from