yalantis / displayswitcher Goto Github PK
View Code? Open in Web Editor NEWCustom transition between two collection view layouts
Home Page: https://yalantis.com
License: MIT License
Custom transition between two collection view layouts
Home Page: https://yalantis.com
License: MIT License
multiple sections are not handled by the layout. Best.
i use the swift4 Branch
at iPhoneX is awesome !
but in iPhone 6 、iPhoneSe like video
https://goo.gl/TCwbw5
plz help me
When I use in Objective-C
I cannot setup a TransitionManager.
Build Error:
Use of undeclared identifier 'TransitionManager'
Hi,
Followed the useage guide in a simple project with a button to switch the layout. But trying to switch layout outputs the following error in the TransitionManager class:
Could not cast value of type 'UICollectionViewTransitionLayout' (0x1775b1c) to 'DisplaySwitcher.TransitionLayout' (0xbff60).
Have I missed something?
Thanks.
Btw - I tried setting the initial layout as the grid but the first view was still a list. Is that expected behaviour??
Xcode 8.1/swift 3
When using DisplaySwitcher in an Objective-C project the init method on DisplaySwitchLayout is public init(staticCellHeight: CGFloat, nextLayoutStaticCellHeight: CGFloat, layoutState: LayoutState)
is not available to Obj-C code. The only init method is initWithCoder.
Using Xcode version 8.0 (8A218a) and macOS 10.12. iOS deployment target 10.0.
It seems there is a problem with this lib and swift 3 perhaps?...
*** Building scheme "DisplaySwitcher" in DisplaySwitcher.xcworkspace
/usr/bin/xcrun xcodebuild -workspace /Users/Shared/xna/frontend/apps/ios/xxxx/Carthage/Checkouts/DisplaySwitcher/Example/DisplaySwitcher.xcworkspace -scheme DisplaySwitcher -configuration DEBUG -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build2016-09-23 17:29:39.238 xcodebuild[30695:20532020] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin' not present in DVTPlugInCompatibilityUUIDs
Build settings from command line:
BITCODE_GENERATION_MODE = bitcode
CARTHAGE = YES
CODE_SIGN_IDENTITY =
CODE_SIGNING_REQUIRED = NO
ONLY_ACTIVE_ARCH = NO
SDKROOT = iphoneos10.0
=== CLEAN TARGET DisplaySwitcher OF PROJECT Pods WITH THE DEFAULT CONFIGURATION (Release) ===
Check dependencies
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.
** CLEAN FAILED **
The following build commands failed:
Check dependencies
(1 failure)
=== BUILD TARGET DisplaySwitcher OF PROJECT Pods WITH THE DEFAULT CONFIGURATION (Release) ===
Check dependencies
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.
** BUILD FAILED **
The following build commands failed:
Check dependencies
(1 failure)
A shell task (/usr/bin/xcrun xcodebuild -workspace /Users/Shared/xna/frontend/apps/ios/xxCarthage/Checkouts/DisplaySwitcher/Example/DisplaySwitcher.xcworkspace -scheme DisplaySwitcher -configuration DEBUG -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES clean build) failed with exit code 65:
2016-09-23 17:29:39.238 xcodebuild[30695:20532020] [MT] PluginLoading: Required plug-in compatibility UUID 8A66E736-A720-4B3C-92F1-33D9962C69DF for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/Alcatraz.xcplugin' not present in DVTPlugInCompatibilityUUIDs
** CLEAN FAILED **
The more information you provide, the faster we can help you.
i want to switch between list and card view mood not grid
The first layout transition is broken if the first layout configuration is .grid
Update the example project with the following:
fileprivate var layoutState: LayoutState = .grid
fileprivate func setupCollectionView() {
collectionView.collectionViewLayout = gridLayout
// ...
}
Proper animation for the layout transition
The first animation is not smooth and flickers
Simply updating your example project with the code previously provided:
setupCollectionView
method for a gridLayout.layoutState
to .grid
Hi, it's possible use DisplaySwitcher without pod o carthage but with a manual Installation?
thank you
It seems that your podspec file is setting version to be 1.0.1 while current version with Swift 4 support is 1.1
Can you update it?
Please add carthage compatibility. Or if it is fine by you, I'll add it and upload it to my repo and link your readme. Thanks.
Hello,
I've tried to use Cocoapods to install this library however it doesn't seem to be updated to the latest version.
I've tried to get latest version from github but either I've used wrong syntax or it should've been updated on Cocoapods.
Main issue is that I can't get the swift 4 version.
Hello,
It would be really nice if this component could be installed via SPM.
Is that a planned feature already?
Hi,
Thanks for your amazing repo.
I have two issues:
func collectionView(collectionView: UICollectionView,
didSelectItemAtIndexPath indexPath: NSIndexPath) {
print("Hi \(indexPath.row)")
}
But it doesn't work! Why?
2 . There is a warning:
plain style unsupported in a navigation item.
To solve it just change Bar Button Item Style to Bordered as shown in the attached image.
Could it support ios 7 ?
Keep getting the error Invalid parameter not satisfying: (name != nil) && ([name length] > 0)
while loading the view, app works, everything works, just loading the view crashes the app.
Specs satisfying the DisplaySwitcher (~> 0.1.0)
dependency were found, but they required a higher minimum deployment target.
Hi,
Sorry for posting here, this is not really an issue.
I'd like to know if it's possible to set my own cell padding in the object BaseLayout.
I want a very thin space between cells in grid mode.
Kind regards,
please help me
while i carthage update , an error happened as below
while i pod install, another error happened
[!] Unable to find a specification for DisplaySwitcher (~> 1.0)
I want to transition from List to Grid Layout when rotation from portrait to landscape.
How to achieve it ?
report a bug
When testing the demo I sometimes get a contraint error when changing layout:
2017-01-23 02:15:58.926309 DisplaySwitcher_Example[8893:1432862] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x61800008c170 H:|-(10)-[UILabel:0x7fe945b1ded0'Marry Kennedy'] (active, names: '|':UIView:0x7fe945b1dd30 )>",
"<NSLayoutConstraint:0x61800008b270 H:[UILabel:0x7fe945b1ded0'Marry Kennedy']-(11)-| (active, names: '|':UIView:0x7fe945b1dd30 )>",
"<NSLayoutConstraint:0x61800008b6d0 UIImageView:0x7fe945b1e160.width == 1 (active)>",
"<NSLayoutConstraint:0x61800008c3f0 UIImageView:0x7fe945b1e160.width == UIView:0x7fe945b1dd30.width (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x61800008b270 H:[UILabel:0x7fe945b1ded0'Marry Kennedy']-(11)-| (active, names: '|':UIView:0x7fe945b1dd30 )>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
Hi 0
Hi 0
Hi 0
Hi 0
Hi 0
2017-01-23 02:16:17.912348 DisplaySwitcher_Example[8893:1432862] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/Kevin/Library/Developer/CoreSimulator/Devices/28151775-0F99-4CC1-9CF3-3060CC67F995/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-01-23 02:16:17.912974 DisplaySwitcher_Example[8893:1432862] [MC] Reading from private effective user settings.
2017-01-23 02:16:31.670696 DisplaySwitcher_Example[8893:1432862] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x608000084e70 H:|-(10)-[UILabel:0x7fe942437b70'Leo Nicholson'] (active, names: '|':UIView:0x7fe9424379d0 )>",
"<NSLayoutConstraint:0x60800008acd0 H:[UILabel:0x7fe942437b70'Leo Nicholson']-(11)-| (active, names: '|':UIView:0x7fe9424379d0 )>",
"<NSLayoutConstraint:0x608000094730 UIImageView:0x7fe942437e00.width == 3 (active)>",
"<NSLayoutConstraint:0x608000092a20 UIImageView:0x7fe942437e00.width == UIView:0x7fe9424379d0.width (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60800008acd0 H:[UILabel:0x7fe942437b70'Leo Nicholson']-(11)-| (active, names: '|':UIView:0x7fe9424379d0 )>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2017-01-23 02:16:38.154543 DisplaySwitcher_Example[8893:1432862] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x61800008ff50 H:|-(10)-[UILabel:0x7fe942700440'Monica Lamberts'] (active, names: '|':UIView:0x7fe942702c80 )>",
"<NSLayoutConstraint:0x618000088390 H:[UILabel:0x7fe942700440'Monica Lamberts']-(11)-| (active, names: '|':UIView:0x7fe942702c80 )>",
"<NSLayoutConstraint:0x618000082710 UIImageView:0x7fe9427013f0.width == 3 (active)>",
"<NSLayoutConstraint:0x618000084060 UIImageView:0x7fe9427013f0.width == UIView:0x7fe942702c80.width (active)>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x618000088390 H:[UILabel:0x7fe942700440'Monica Lamberts']-(11)-| (active, names: '|':UIView:0x7fe942702c80 )>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
I am running Xcode 8.2.1
Simulator: Iphone 5s ios 10.2
I used this method but it didn't work:
collectionView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
Settings a custom contentInset
on the collection view breaks the layout after changing the layout several times
Update the example code with the following:
@IBOutlet fileprivate weak var collectionView: UICollectionView! {
didSet {
collectionView.contentInset = UIEdgeInsets(top: 4, left: 4, bottom: 4, right: 4)
}
}
Set the custom contentInset
on the collection view and display cells normally
The custom contentInset
seems to be used but the layout is broken, there is a huge empty space before the first cell appear and the layout animation flickers.
Simply updating your example project with the code previously provided on the UICollectionView outlet.
Since the update to Swift 3 the project is missing the Carthage compatible header in the README.md. Is it simply missing or is the project no longer compatible? Thanks.
Hi. Could you please help me. I saw that in your example project there is a container view inside bar button. I tried to do the same in my project using storyboard, but couldn't. Now I just copied it from your example project and set up. How could you add container view with buttons inside bar button?
[!] Unable to satisfy the following requirements:
DisplaySwitcher (~> 1.0)
required by Podfile
None of your spec sources contain a spec satisfying the dependency: DisplaySwitcher (~> 1.0)
.
You have either:
pod repo update
.Note: as of CocoaPods 1.0, pod repo update
does not happen on pod install
by default.
Could you please update cocoapods trunk? the latest release there 1.0.1.
Thank you!
Could not cast value of type 'UICollectionViewTransitionLayout' (0x10b5dbb08) to 'DisplaySwitcher.TransitionLayout' (0x1087e88f8).
In this function
open func startInteractiveTransition() {
UIApplication.shared.beginIgnoringInteractionEvents()
transitionLayout = collectionView.startInteractiveTransition(to: destinationLayout) { success, finish in
if success && finish {
self.collectionView.reloadData()
UIApplication.shared.endIgnoringInteractionEvents()
}
} as! TransitionLayout
transitionLayout.layoutState = layoutState
createUpdaterAndStart()
}
I used stretchy Header FlowLayout
after import DisplaySwitcher my Header doesn't seem anymore?
import UIKit
class STCollectionViewFlowLayout: UICollectionViewFlowLayout {
override func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool {
return true
}
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
let layoutAttributes = super.layoutAttributesForElements(in: rect)
layoutAttributes?.forEach({ (attributes) in
if attributes.representedElementKind == UICollectionView.elementKindSectionHeader {
guard let collectionView = collectionView else {
return
}
let contentOffsetY = collectionView.contentOffset.y
if contentOffsetY > 0 {
return
}
let width = collectionView.frame.width
let height: CGFloat = attributes.frame.height - contentOffsetY
attributes.frame = CGRect(x: 0, y: contentOffsetY, width: width, height: height)
}
})
return layoutAttributes
}
}
$ pod --version
1.1.0.beta.1
$ pod install
[!] Invalid `Podfile` file: [!] Unsupported options `{:exclusive=>true}` for target `DisplaySwitcher_Example`..
# from /Users/aaron/Downloads/DisplaySwitcher-master/Example/Podfile:4
# -------------------------------------------
#
> target 'DisplaySwitcher_Example', :exclusive => true do
# pod 'DisplaySwitcher', :path => '../'
# -------------------------------------------
The more information you provide, the faster we can help you.
Please describe what you want to add to the component.
Please add images.
Please replace this with what you did.
Please replace this with what you expected to happen.
Please replace this with what happened instead.
pod env | pbcopy
and insert herecarthage version | pbcopy
and insert herePlease add a link to a project we can download that reproduces the bug.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.