A stacked view layout with gesture-based reordering using a UICollectionView -- inspired by Passbook and Reminders apps.
Objective-C
1,199
154 commits
updated Sep 27, 2019
A stack layout with gesture-based reordering using UICollectionView -- inspired by Passbook and Reminders apps.
Take a look at sample project TGLStackedViewExample.xcodeproj. You may use sample class TGLViewController as a starting point for your own implementation.
Via CocoaPods:
pod 'TGLStackedViewController', '~> 2.2' to your project's PodfileVia Carthage:
github "gleue/TGLStackedViewController", ~> 2.2 to your project's CartfileOr the "classic" way:
TGLStackedViewController to your projectThen in your project:
TGLStackedViewControllerUICollectionViewDataSource protocol in your subclass
-numberOfSectionsInCollectionView has to return 1. TGLStackedViewController provides a suitable implementation for you -- no need to overwrite.-numberOfSectionsInCollectionView: and -collectionView:cellForItemAtIndexPath as usual.TGLStackedViewController's implementation of method -collectionView:canMoveItemAtIndexPath: checks for stacked layout and a minimum number of 2 items before allowing reordering. Make sure to call super in your implementation and honor it's result.-collectionView:moveItemAtIndexPath:toIndexPath: to update your data model after items have been reorderedUICollectionViewDelegate protocol in your subclass
TGLStackedViewController already implements methods -collectionView:shouldHighlightItemAtIndexPath:, -collectionView:didDeselectItemAtIndexPath, and -collectionView:didSelectItemAtIndexPath: internally, so make sure to call super in your implementation.-collectionView:targetContentOffsetForProposedContentOffset: is crucuial for properly transitioning betwenn exposed and stacked layout, so make sure to call super in your implementation.UICollectionViewController in your storyboard and set its class to your derived class
delegate and dataSource connections properlyTGLStackedViewController does no longer create a layout object internally.
TGLStackedLayout or your own subclass of TGLStackedLayout in the inspector in Interface Builder.TGLStackedViewController in code you have to set the collection view's layout before presenting the view controller.Podspec by Pierre DulacTGLStackedViewController is available under the MIT License (MIT)
Copyright (c) 2014-2019 Tim Gleue (http://gleue-interactive.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1,055 followers · starred May 2014
48 followers · starred Aug 2014
A stacked view layout with gesture-based reordering using a UICollectionView -- inspired by Passbook and Reminders apps.
Objective-C
1,199
154 commits
updated Sep 27, 2019
A stack layout with gesture-based reordering using UICollectionView -- inspired by Passbook and Reminders apps.
Take a look at sample project TGLStackedViewExample.xcodeproj. You may use sample class TGLViewController as a starting point for your own implementation.
Via CocoaPods:
pod 'TGLStackedViewController', '~> 2.2' to your project's PodfileVia Carthage:
github "gleue/TGLStackedViewController", ~> 2.2 to your project's CartfileOr the "classic" way:
TGLStackedViewController to your projectThen in your project:
TGLStackedViewControllerUICollectionViewDataSource protocol in your subclass
-numberOfSectionsInCollectionView has to return 1. TGLStackedViewController provides a suitable implementation for you -- no need to overwrite.-numberOfSectionsInCollectionView: and -collectionView:cellForItemAtIndexPath as usual.TGLStackedViewController's implementation of method -collectionView:canMoveItemAtIndexPath: checks for stacked layout and a minimum number of 2 items before allowing reordering. Make sure to call super in your implementation and honor it's result.-collectionView:moveItemAtIndexPath:toIndexPath: to update your data model after items have been reorderedUICollectionViewDelegate protocol in your subclass
TGLStackedViewController already implements methods -collectionView:shouldHighlightItemAtIndexPath:, -collectionView:didDeselectItemAtIndexPath, and -collectionView:didSelectItemAtIndexPath: internally, so make sure to call super in your implementation.-collectionView:targetContentOffsetForProposedContentOffset: is crucuial for properly transitioning betwenn exposed and stacked layout, so make sure to call super in your implementation.UICollectionViewController in your storyboard and set its class to your derived class
delegate and dataSource connections properlyTGLStackedViewController does no longer create a layout object internally.
TGLStackedLayout or your own subclass of TGLStackedLayout in the inspector in Interface Builder.TGLStackedViewController in code you have to set the collection view's layout before presenting the view controller.Podspec by Pierre DulacTGLStackedViewController is available under the MIT License (MIT)
Copyright (c) 2014-2019 Tim Gleue (http://gleue-interactive.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1,055 followers · starred May 2014
48 followers · starred Aug 2014