Coder Social home page Coder Social logo

ksgalleryslidingcollectionview's Introduction

KSGallerySlidingCollectionView

KSGallerySlidingCollectionView is a collection view menu in the style of UltraVisual.

image

Reference from RPSlidingMenu.But we make some improve Which makes it a highly-customizable lightweight component.

Description

  1. CollectionViewLayout subclass from FlowLayout directly.
  2. Better performance:we do not caculate layoutattributes of all Items.we only recaculate layoutattributes of rect that needed to display.
  3. Highly-customizable and lightweight.

Demo

see KSGallerySlidingCollectionViewDemo

Installation

From CocoaPods

Add pod 'KSGallerySlidingCollectionView' to your Podfile

Usage

(see sample Xcode project in /KSGallerySlidingCollectionViewDemo)

  1. Create a new file that inherits from KSGallerySlidingCell. overload the following method:

     - (void)layoutSubViewsWithPercent:(CGFloat)percentOfGrowth
    

You should do all the position and alpha change dule to the percentOfGrowth

  1. In the ViewController,setup the CollectionView:

     KSGallerySlidingLayout *layout = [[KSGallerySlidingLayout alloc] initWithDelegate:self];
     layout.itemSize = CGSizeMake(CGRectGetWidth(self.collectionView.frame), HomeNewsCellCollapsedHeight);
     self.collectionView.collectionViewLayout = layout;
     [self.collectionView registerNib:[UINib nibWithNibName:@"HomeNewsCell" bundle:nil] forCellWithReuseIdentifier:@"HomeNewsCell"];
    

Advance Customization

  1. You can customize the featureHeight and collapsedHeight.
    set the height after cell intilized:

     self.featureHeight = HomeNewsCellFeatureHeight;
     self.collapsedHeight = HomeNewsCellCollapsedHeight;
    

implement the KSGallerySlidingLayoutLayoutDelegate in the ViewController:

	- (CGFloat)heightForFeatureCell
	{
	    //    return RPSlidingCellFeatureHeight;
	    return HomeNewsCellFeatureHeight;
	}
	
	- (CGFloat)heightForCollapsedCell
	{
	    //    return RPSlidingCellCollapsedHeight;
	    return HomeNewsCellCollapsedHeight;
	}
  1. Customize the cell animation when view scroll all you need to do is overload the following method in you cell,and do all the position and alpha change dule to the percentOfGrowth:

     - (void)layoutSubViewsWithPercent:(CGFloat)percentOfGrowth
    

Notes

If you have any suggestions feel free to contact me.

ksgalleryslidingcollectionview's People

Contributors

btxkenshin avatar lazykaka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

nights-of-ice

ksgalleryslidingcollectionview's Issues

Height for each cell

Hi! thanks for this contribution I can see how this project behaves much better than RPSlidingMenu.
Is it possible to set a different feature height for each cell?
Thanks again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.