Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed5aa2f8a8 |
@@ -41,17 +41,17 @@ extension AppDelegate {
|
||||
|
||||
private func configureNavigationTabBar() {
|
||||
//transparent background
|
||||
UINavigationBar.appearance().setBackgroundImage(UIImage(), forBarMetrics: .Default)
|
||||
UINavigationBar.appearance().shadowImage = UIImage()
|
||||
UINavigationBar.appearance().translucent = true
|
||||
|
||||
let shadow = NSShadow()
|
||||
shadow.shadowOffset = CGSize(width: 0, height: 2)
|
||||
shadow.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.1)
|
||||
|
||||
UINavigationBar.appearance().titleTextAttributes = [
|
||||
NSForegroundColorAttributeName : UIColor.whiteColor(),
|
||||
NSShadowAttributeName: shadow
|
||||
]
|
||||
// UINavigationBar.appearance().setBackgroundImage(UIImage(), forBarMetrics: .Default)
|
||||
// UINavigationBar.appearance().shadowImage = UIImage()
|
||||
// UINavigationBar.appearance().translucent = true
|
||||
//
|
||||
// let shadow = NSShadow()
|
||||
// shadow.shadowOffset = CGSize(width: 0, height: 2)
|
||||
// shadow.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.1)
|
||||
//
|
||||
// UINavigationBar.appearance().titleTextAttributes = [
|
||||
// NSForegroundColorAttributeName : UIColor.whiteColor(),
|
||||
// NSShadowAttributeName: shadow
|
||||
// ]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
<!--Demo Table View Controller-->
|
||||
<scene sceneID="7Xk-ar-e7L">
|
||||
<objects>
|
||||
<tableViewController storyboardIdentifier="DemoTableViewController" automaticallyAdjustsScrollViewInsets="NO" id="7RW-i0-HfN" customClass="DemoTableViewController" customModule="DemoExpandingCollection" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableViewController storyboardIdentifier="DemoTableViewController" id="7RW-i0-HfN" customClass="DemoTableViewController" customModule="DemoExpandingCollection" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="static" style="plain" separatorStyle="none" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="2SU-lJ-2AP">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
@@ -109,7 +109,7 @@
|
||||
<tableViewSection id="IIl-eL-sK9">
|
||||
<cells>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="CustomTableViewCell" rowHeight="124" id="SFA-X2-Rbf">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="124"/>
|
||||
<rect key="frame" x="0.0" y="44" width="600" height="124"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="SFA-X2-Rbf" id="RQr-Ti-ps0">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="124"/>
|
||||
@@ -146,7 +146,7 @@
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="124" id="ew1-hI-ark">
|
||||
<rect key="frame" x="0.0" y="124" width="600" height="124"/>
|
||||
<rect key="frame" x="0.0" y="168" width="600" height="124"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="ew1-hI-ark" id="tMC-aw-BE2">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="124"/>
|
||||
@@ -201,7 +201,7 @@
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="124" id="0ee-7A-I2I">
|
||||
<rect key="frame" x="0.0" y="248" width="600" height="124"/>
|
||||
<rect key="frame" x="0.0" y="292" width="600" height="124"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="0ee-7A-I2I" id="jPx-eH-c2S">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="124"/>
|
||||
@@ -256,7 +256,7 @@
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="124" id="fTH-KP-Ac5">
|
||||
<rect key="frame" x="0.0" y="372" width="600" height="124"/>
|
||||
<rect key="frame" x="0.0" y="416" width="600" height="124"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="fTH-KP-Ac5" id="BGd-Mp-TnE">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="124"/>
|
||||
@@ -311,7 +311,7 @@
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="124" id="irZ-0L-X9r">
|
||||
<rect key="frame" x="0.0" y="496" width="600" height="124"/>
|
||||
<rect key="frame" x="0.0" y="540" width="600" height="124"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="irZ-0L-X9r" id="t3x-Eb-ktg">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="124"/>
|
||||
@@ -366,7 +366,7 @@
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="124" id="Fj4-n4-S6M">
|
||||
<rect key="frame" x="0.0" y="620" width="600" height="124"/>
|
||||
<rect key="frame" x="0.0" y="664" width="600" height="124"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="Fj4-n4-S6M" id="D8J-AG-YUN">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="124"/>
|
||||
|
||||
@@ -37,6 +37,6 @@
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -37,7 +37,7 @@ github "Ramotion/expanding-collection"
|
||||
## Usage
|
||||
|
||||
```swift
|
||||
import ExpandingCollection
|
||||
import expanding_collection
|
||||
```
|
||||
|
||||
#### Create CollectionViewCell
|
||||
|
||||
@@ -101,20 +101,17 @@ extension BasePageCollectionCell {
|
||||
public func cellIsOpen(isOpen: Bool, animated: Bool = true) {
|
||||
if isOpen == isOpened { return }
|
||||
|
||||
frontConstraintY.constant = isOpen == true ? -frontContainerView.bounds.size.height / 5 : 0
|
||||
backConstraintY.constant = isOpen == true ? frontContainerView.bounds.size.height / 5 - yOffset / 2 : 0
|
||||
frontConstraintY.constant = isOpen == true ? -bounds.size.height / 5 : 0
|
||||
backConstraintY.constant = isOpen == true ? bounds.size.height / 5 - yOffset / 2 : 0
|
||||
|
||||
if let widthConstant = backContainerView.getConstraint(.Width) {
|
||||
widthConstant.constant = isOpen == true ? frontContainerView.bounds.size.width + yOffset : frontContainerView.bounds.size.width
|
||||
widthConstant.constant = isOpen == true ? contentView.bounds.size.width + yOffset : contentView.bounds.size.width
|
||||
}
|
||||
|
||||
if let heightConstant = backContainerView.getConstraint(.Height) {
|
||||
heightConstant.constant = isOpen == true ? frontContainerView.bounds.size.height + yOffset : frontContainerView.bounds.size.height
|
||||
heightConstant.constant = isOpen == true ? contentView.bounds.size.height + yOffset : contentView.bounds.size.height
|
||||
}
|
||||
|
||||
configurationCell()
|
||||
|
||||
|
||||
if animated == true {
|
||||
UIView.animateWithDuration(0.3, delay: 0, options: .CurveEaseInOut, animations: {
|
||||
self.contentView.layoutIfNeeded()
|
||||
@@ -181,14 +178,6 @@ extension BasePageCollectionCell {
|
||||
|
||||
return shadow
|
||||
}
|
||||
|
||||
func configurationCell() {
|
||||
frame.size.height += (superview?.frame.size.height)!
|
||||
frame.origin.y -= (superview?.frame.size.height)! / 2
|
||||
frame.origin.x -= yOffset / 2
|
||||
frame.size.width += yOffset
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: NSCoding
|
||||
|
||||
@@ -105,7 +105,7 @@ extension ExpandingViewController {
|
||||
|
||||
// MARK: UICollectionViewDataSource
|
||||
|
||||
extension ExpandingViewController: UICollectionViewDataSource, UICollectionViewDelegate {
|
||||
extension ExpandingViewController: UICollectionViewDataSource, UICollectionViewDelegate{
|
||||
|
||||
public func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
fatalError("need emplementation in subclass")
|
||||
@@ -116,15 +116,3 @@ extension ExpandingViewController: UICollectionViewDataSource, UICollectionViewD
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: UIScrollViewDelegate
|
||||
|
||||
extension ExpandingViewController {
|
||||
|
||||
public func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
|
||||
let indexPath = NSIndexPath(forRow: currentIndex, inSection: 0)
|
||||
if case let currentCell as BasePageCollectionCell = collectionView?.cellForItemAtIndexPath(indexPath) {
|
||||
currentCell.configurationCell()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'expanding-collection'
|
||||
s.version = '0.2.0'
|
||||
s.version = '0.1.1'
|
||||
s.summary = 'Transition animtion from CollectionView to TableView'
|
||||
s.license = 'MIT'
|
||||
s.homepage = 'https://github.com/Ramotion/expanding-collection'
|
||||
|
||||
Reference in New Issue
Block a user