Compare commits

...
21 Commits
Author SHA1 Message Date
Alex K 9f55d701a1 project settings 2018-05-30 09:35:18 +03:00
Alex c9a00bba92 Merge pull request #82 from akihiyo76/fix/isuue_#81
fix issue 81
2018-05-30 09:30:04 +03:00
akihiyo76 2315429724 fix not call didSelectItem method 2018-05-30 15:22:24 +09:00
Ramotion d71ab75f6f Update README.md 2018-05-29 12:03:58 +03:00
Ramotion 09ae1b08dd Update README.md 2018-04-28 16:09:18 +03:00
Ramotion 988f36f4bd Add files via upload 2018-04-28 06:08:21 -07:00
Ramotion 56298faab4 Update README.md 2018-04-18 14:48:15 +03:00
Alex K 8a712f23bc update podspec 2018-04-02 16:27:41 +03:00
Alex c0fcff5202 Merge pull request #78 from calvinsug/master
fix deprecated Swift
2018-04-02 15:13:40 +03:00
Calvin Sugianto f2f31ba167 fix deprecated Swift 2018-04-02 16:06:26 +07:00
Ramotion 56bf333791 Update README.md 2018-03-02 11:52:15 +03:00
Alex Mikhnev e8e36b9804 Update README.md 2018-02-21 14:44:56 +03:00
Alex K 5986f1c286 update podspec 2018-01-29 11:57:43 +03:00
Alex K fc70562947 Fixes #66 2018-01-29 11:47:58 +03:00
Alex K 03704d1227 fix demo project
Fixes #3
2018-01-25 10:35:16 +03:00
Alex K e72546bc43 update readme 2018-01-24 16:29:52 +03:00
Alex K 436bba428a update podspec 2018-01-24 14:08:39 +03:00
Alex K 521c534a30 Fixes #62 2018-01-24 14:07:21 +03:00
Alex K de19661aa5 update podspec 2018-01-24 12:04:29 +03:00
Alex K a4d60e40f7 Merge branch 'fix69'
# Conflicts:
#	Source/ExpandingTableViewController/ExpandingTableViewController.swift
#	Source/TransitionDriver/TransitionDriver.swift
2018-01-24 12:00:23 +03:00
Alex K 938a7a13c0 Fixes #69 2018-01-24 11:57:57 +03:00
12 changed files with 68 additions and 95 deletions
@@ -400,7 +400,6 @@
isa = PBXNativeTarget;
buildConfigurationList = 848596451CF585F3000BCC74 /* Build configuration list for PBXNativeTarget "DemoExpandingCollection" */;
buildPhases = (
8485968F1CF58B8A000BCC74 /* Images Generator */,
848596241CF585F3000BCC74 /* Sources */,
848596251CF585F3000BCC74 /* Frameworks */,
848596261CF585F3000BCC74 /* Resources */,
@@ -441,7 +440,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0920;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "Alex K.";
TargetAttributes = {
848596271CF585F3000BCC74 = {
@@ -496,23 +495,6 @@
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
8485968F1CF58B8A000BCC74 /* Images Generator */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Images Generator";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftgen >/dev/null; then\nswiftgen images \"$PROJECT_DIR/DemoExpandingCollection/Assets.xcassets\" -t swift3 --output \"$PROJECT_DIR/DemoExpandingCollection/Constants/Images.swift\"\nelse\necho \"warning: SwiftGen not installed, download it from https://github.com/AliSoftware/SwiftGen\"\nfi";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
848596241CF585F3000BCC74 /* Sources */ = {
isa = PBXSourcesBuildPhase;
@@ -602,12 +584,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -655,12 +639,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0920"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
@@ -37,7 +36,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
@@ -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
}
}
@@ -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()
@@ -114,7 +114,7 @@ extension DemoViewController {
cell.cellIsOpen(cellsIsOpen[index], animated: false)
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: IndexPath) {
override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
guard let cell = collectionView.cellForItem(at: indexPath) as? DemoCollectionViewCell
, currentIndex == indexPath.row else { return }
+25 -18
View File
@@ -1,5 +1,6 @@
![header](./header.png)
![animation](./preview.gif)
<img src="https://github.com/Ramotion/expanding-collection/blob/master/expanding-collection.gif" width="600" height="450" />
<br><br/>
# expanding-collection
@@ -10,9 +11,10 @@
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Ramotion/expanding-collection)
[![Travis](https://travis-ci.org/Ramotion/expanding-collection.svg?branch=master)](https://travis-ci.org/Ramotion/expanding-collection)
[![codebeat badge](https://codebeat.co/badges/6a009992-5bf2-4730-aa35-f3b20ce7693d)](https://codebeat.co/projects/github-com-ramotion-expanding-collection)
[![Donate](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://paypal.me/Ramotion)
# 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,16 +24,16 @@ 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://dev.ramotion.com/?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection-contact-us">
<img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a> <br>
The [iPhone mockup](https://store.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection) available [here](https://store.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection).
The [iPhone mockup](https://store.ramotion.com/product/iphone-x-clay-mockups?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection) available [here](https://store.ramotion.com?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection).
## Requirements
- iOS 9.0+
- Xcode 8
- Xcode 9.0+
## Installation
@@ -39,12 +41,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 +83,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 +153,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,13 +188,13 @@ 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://dev.ramotion.com/?utm_source=gthb&utm_medium=special&utm_campaign=expanding-collection-contact-us">
<img src="https://github.com/ramotion/gliding-collection/raw/master/contact_our_team@2x.png" width="187" height="34"></a>
<br>
<br>
Follow us for the latest updates<br>
[![Twitter URL](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=https://github.com/ramotion/expanding-collection)
[![Twitter Follow](https://img.shields.io/twitter/follow/ramotion.svg?style=social)](https://twitter.com/ramotion)
<a href="https://goo.gl/rPFpid" >
<img src="https://i.imgur.com/ziSqeSo.png/" width="156" height="28"></a>
@@ -12,8 +12,7 @@ import UIKit
open class ExpandingTableViewController: UITableViewController {
// MARK: Vars
/// The height of the table view header
/// The height of the table view header, set before transition
open var headerHeight: CGFloat = 236
var transitionDriver: TransitionDriver?
@@ -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: {
@@ -177,7 +176,9 @@ extension BasePageCollectionCell {
contentView.insertSubview(shadow, belowSubview: view)
// create constraints
for info: (attribute: NSLayoutAttribute, scale: CGFloat) in [(NSLayoutAttribute.width, 0.8), (NSLayoutAttribute.height, 0.9)] {
let frontViewlayoutAttribs:[(NSLayoutAttribute, CGFloat)] = [(NSLayoutAttribute.width, 0.8), (NSLayoutAttribute.height, 0.9)]
for info: (attribute: NSLayoutAttribute, scale: CGFloat) in frontViewlayoutAttribs {
if let frontViewConstraint = view.getConstraint(info.attribute) {
shadow >>>- {
$0.attribute = info.attribute
@@ -186,8 +187,10 @@ extension BasePageCollectionCell {
}
}
}
for info: (attribute: NSLayoutAttribute, offset: CGFloat) in [(NSLayoutAttribute.centerX, 0), (NSLayoutAttribute.centerY, 30)] {
let contentViewlayoutAttribs:[(NSLayoutAttribute, CGFloat)] = [(NSLayoutAttribute.centerX, 0), (NSLayoutAttribute.centerY, 30)]
for info: (attribute: NSLayoutAttribute, offset: CGFloat) in contentViewlayoutAttribs {
(contentView, shadow, view) >>>- {
$0.attribute = info.attribute
$0.constant = info.offset
@@ -204,22 +207,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, *) {
@@ -118,6 +118,9 @@ extension ExpandingViewController: UICollectionViewDataSource, UICollectionViewD
cell.configureCellViewConstraintsWithSize(itemSize)
}
open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
}
open func collectionView(_: UICollectionView, numberOfItemsInSection _: Int) -> Int {
fatalError("need emplementation in subclass")
@@ -127,15 +130,3 @@ extension ExpandingViewController: UICollectionViewDataSource, UICollectionViewD
fatalError("need emplementation in subclass")
}
}
// MARK: UIScrollViewDelegate
extension ExpandingViewController {
public func scrollViewDidEndDecelerating(_: UIScrollView) {
let indexPath = IndexPath(row: currentIndex, section: 0)
if case let currentCell as BasePageCollectionCell = collectionView?.cellForItem(at: indexPath) {
currentCell.configurationCell()
}
}
}
@@ -227,7 +227,7 @@ extension TransitionDriver {
}
backViewFrame.origin.y = cell.backConstraintY.constant
cell.backConstraintY.constant = view.bounds.size.height / 2 - (view.bounds.size.height - 236) / 2 + insets
cell.backConstraintY.constant = view.bounds.size.height / 2 - (view.bounds.size.height - height) / 2 + insets
}
fileprivate func closeBackViewConfigurationConstraints(_ cell: BasePageCollectionCell?) {
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 MiB

+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'expanding-collection'
s.version = '1.1.3'
s.version = '2.0.1'
s.summary = 'Transition animtion from CollectionView to TableView'
s.license = 'MIT'
s.homepage = 'https://github.com/Ramotion/expanding-collection'