Coder Social home page Coder Social logo

lisafiedler / aplexpandablecollectionview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from apploft/aplexpandablecollectionview

0.0 1.0 0.0 375 KB

UICollectionView subclass with vertically expandable and collapsible sections

License: MIT License

Ruby 3.89% Objective-C 96.11%

aplexpandablecollectionview's Introduction

APLExpandableCollectionView

UICollectionView subclass with vertically expandable and collapsible sections.

  • animated expand and collapse animation
  • scrolls expanded section to visible
  • customizable flow layout for iPhone and iPad
  • supports single and multiple expanded sections
  • supports addition of sections

iPad Screenshot iPhone Screenshot

Installation

Install via cocoapods by adding this to your Podfile:

pod "APLExpandableCollectionView"

Usage

In your storyboard, set the custom class of your UICollectionView to APLExpandableCollectionView and it's layout to custom, using the APLExpandableSectionFlowLayout class.

You might want to customize the collection view layout's sectionInset, minimumLineSpacing, itemSize, etc. to fit your layout needs and customize the cell appearance depending on whether it is a section's first cell, which is the "header cell", or a regular item. Check out the demo project as reference.

If you are not interested in expandable cells but would like to use a UICollectionViewFlowLayout which layouts it's sections and their items from top to bottom, left to right instead of left to right, top to bottom as displayed on the iPad screenshot, you could benefit from the APLSectionTopToBottomFlowLayout. It is inherited by the APLExpandableSectionFlowLayout but could be used on its own.

Collapsing all expanded sections before expanding the next section

self.collectionView.allowsMultipleExpandedSections = NO;

Dynamically adding sections

Adds a new section after the existing sections and displays it as collapsed:

[self.collectionView addExpandedSection:NO];

Adds a new section before the existing sections and displays it as expanded:

[self.collectionView insertExpandedSection:YES atIndex:0];

aplexpandablecollectionview's People

Contributors

michaelkamphausen avatar stel4e avatar

Watchers

 avatar

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.