Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc70562947 | ||
|
|
03704d1227 | ||
|
|
e72546bc43 | ||
|
|
436bba428a |
+9
-12
@@ -54,18 +54,15 @@ extension DemoTableViewController {
|
||||
extension DemoTableViewController {
|
||||
|
||||
override func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
// if scrollView.contentOffset.y < -25 {
|
||||
// // buttonAnimation
|
||||
// let viewControllers: [DemoViewController?] = navigationController?.viewControllers.map { $0 as? DemoViewController } ?? []
|
||||
//
|
||||
// for viewController in viewControllers {
|
||||
// if let rightButton = viewController?.navigationItem.rightBarButtonItem as? AnimatingBarButton {
|
||||
// rightButton.animationSelected(false)
|
||||
// }
|
||||
// }
|
||||
// popTransitionAnimation()
|
||||
// }
|
||||
|
||||
if scrollView.contentOffset.y < -25 , let navigationController = navigationController {
|
||||
// buttonAnimation
|
||||
for case let viewController as DemoViewController in navigationController.viewControllers {
|
||||
if case let rightButton as AnimatingBarButton = viewController.navigationItem.rightBarButtonItem {
|
||||
rightButton.animationSelected(false)
|
||||
}
|
||||
}
|
||||
popTransitionAnimation()
|
||||
}
|
||||
scrollOffsetY = scrollView.contentOffset.y
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ class DemoViewController: ExpandingViewController {
|
||||
extension DemoViewController {
|
||||
|
||||
override func viewDidLoad() {
|
||||
itemSize = CGSize(width: 256, height: 335)
|
||||
itemSize = CGSize(width: 256, height: 460)
|
||||
super.viewDidLoad()
|
||||
|
||||
registerCell()
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
[](https://codebeat.co/projects/github-com-ramotion-expanding-collection)
|
||||
|
||||
# Check this library on other platforms:
|
||||
<a href="https://github.com/Ramotion/expanding-collection-android">
|
||||
<a href="https://github.com/Ramotion/expanding-collection-android">
|
||||
<img src="https://github.com/ramotion/navigation-stack/raw/master/Android_Java@2x.png" width="178" height="81"></a>
|
||||
|
||||
## About
|
||||
@@ -22,7 +22,7 @@ We specialize in the designing and coding of custom UI for Mobile Apps and Websi
|
||||
**Looking for developers for your project?**<br>
|
||||
This project is maintained by Ramotion, Inc. We specialize in the designing and coding of custom UI for Mobile Apps and Websites.
|
||||
|
||||
<a href="https://ramotion.com/?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection-contact-us/#Get_in_Touch">
|
||||
<a href="https://ramotion.com/?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection-contact-us/#Get_in_Touch">
|
||||
<img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a> <br>
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ The [iPhone mockup](https://store.ramotion.com?utm_source=gthb&utm_medium=specia
|
||||
## Requirements
|
||||
|
||||
- iOS 9.0+
|
||||
- Xcode 8
|
||||
- Xcode 9.0+
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -39,12 +39,9 @@ Just add the Source folder to your project.
|
||||
|
||||
or use [CocoaPods](https://cocoapods.org) with Podfile:
|
||||
``` ruby
|
||||
pod 'expanding-collection', '~> 1.1.2' swift 4
|
||||
|
||||
pod 'expanding-collection', '~> 1.0.3' swift 3
|
||||
|
||||
pod 'expanding-collection', '~> 0.3.2' swift 2
|
||||
pod 'expanding-collection'
|
||||
```
|
||||
|
||||
or [Carthage](https://github.com/Carthage/Carthage) users can simply add to their `Cartfile`:
|
||||
```
|
||||
github "Ramotion/expanding-collection"
|
||||
@@ -84,7 +81,7 @@ import expanding_collection
|
||||
|
||||
``` swift
|
||||
override func viewDidLoad() {
|
||||
itemSize = CGSize(width: 214, height: 264)
|
||||
itemSize = CGSize(width: 214, height: 460) //IMPORTANT!!! Height of open state cell
|
||||
super.viewDidLoad()
|
||||
|
||||
// register cell
|
||||
@@ -154,10 +151,18 @@ func scrollViewDidEndDecelerating(scrollView: UIScrollView) {
|
||||
2) Set header height default 236
|
||||
|
||||
``` swift
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
|
||||
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
|
||||
headerHeight = ***
|
||||
}
|
||||
}
|
||||
```
|
||||
OR
|
||||
|
||||
``` swift
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
headerHeight = ***
|
||||
}
|
||||
```
|
||||
|
||||
3) Call the push method in YourViewController to YourTableViewController
|
||||
@@ -181,9 +186,9 @@ See [LICENSE](./LICENSE) for details.
|
||||
# Get the Showroom App for iOS to give it a try
|
||||
Try this UI component and more like this in our iOS app. Contact us if interested.
|
||||
|
||||
<a href="https://itunes.apple.com/app/apple-store/id1182360240?pt=550053&ct=expanding-collection&mt=8" >
|
||||
<a href="https://itunes.apple.com/app/apple-store/id1182360240?pt=550053&ct=expanding-collection&mt=8" >
|
||||
<img src="https://github.com/ramotion/gliding-collection/raw/master/app_store@2x.png" width="117" height="34"></a>
|
||||
<a href="https://ramotion.com/?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection-contact-us/#Get_in_Touch">
|
||||
<a href="https://ramotion.com/?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection-contact-us/#Get_in_Touch">
|
||||
<img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
@@ -109,8 +109,8 @@ extension BasePageCollectionCell {
|
||||
if isOpen == isOpened { return }
|
||||
|
||||
if ySpacing == .greatestFiniteMagnitude {
|
||||
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 ? -frontContainerView.bounds.size.height / 6 : 0
|
||||
backConstraintY.constant = isOpen == true ? frontContainerView.bounds.size.height / 6 - yOffset / 2 : 0
|
||||
} else {
|
||||
frontConstraintY.constant = isOpen == true ? -ySpacing / 2 : 0
|
||||
backConstraintY.constant = isOpen == true ? ySpacing / 2 : 0
|
||||
@@ -133,7 +133,6 @@ extension BasePageCollectionCell {
|
||||
}
|
||||
|
||||
isOpened = isOpen
|
||||
configurationCell()
|
||||
|
||||
if animated == true {
|
||||
UIView.animate(withDuration: 0.3, delay: 0, options: UIViewAnimationOptions(), animations: {
|
||||
@@ -204,22 +203,6 @@ extension BasePageCollectionCell {
|
||||
return shadow
|
||||
}
|
||||
|
||||
func configurationCell() {
|
||||
// Prevents indefinite growing of the cell issue
|
||||
let i: CGFloat = isOpened ? 1 : -1
|
||||
let superHeight = superview?.frame.size.height ?? 0
|
||||
|
||||
frame.size.height += i * superHeight
|
||||
frame.origin.y -= i * superHeight / 2
|
||||
if additionalWidth == .greatestFiniteMagnitude {
|
||||
frame.origin.x -= i * yOffset / 2
|
||||
frame.size.width += i * yOffset
|
||||
} else {
|
||||
frame.origin.x -= i * additionalWidth / 2
|
||||
frame.size.width += i * additionalWidth
|
||||
}
|
||||
}
|
||||
|
||||
func configureCellViewConstraintsWithSize(_ size: CGSize) {
|
||||
guard isOpened == false && frontContainerView.getConstraint(.width)?.constant != size.width else { return }
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ import UIKit
|
||||
/// UIViewController with UICollectionView with custom transition method
|
||||
open class ExpandingViewController: UIViewController {
|
||||
|
||||
/// The default size to use for cells.
|
||||
open var itemSize = CGSize(width: 256, height: 335)
|
||||
/// The default size to use for cells. Height of open cell state
|
||||
open var itemSize = CGSize(width: 256, height: 460)
|
||||
|
||||
/// The collection view object managed by this view controller.
|
||||
open var collectionView: UICollectionView?
|
||||
@@ -86,7 +86,7 @@ extension ExpandingViewController {
|
||||
let layout = PageCollectionLayout(itemSize: itemSize)
|
||||
collectionView = PageCollectionView.createOnView(view,
|
||||
layout: layout,
|
||||
height: itemSize.height + itemSize.height / 5 * 2,
|
||||
height: itemSize.height,
|
||||
dataSource: self,
|
||||
delegate: self)
|
||||
if #available(iOS 10.0, *) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'expanding-collection'
|
||||
s.version = '1.1.4'
|
||||
s.version = '1.1.5'
|
||||
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