Coder Social home page Coder Social logo

samback / bddynamicgridviewcontroller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from norsez/bddynamicgridviewcontroller

0.0 2.0 0.0 1.66 MB

Data-aware view-controller that displays a UIView list in an automatically laid out grid

Home Page: https://github.com/norsez/BDDynamicGridViewController

License: BSD 3-Clause "New" or "Revised" License

bddynamicgridviewcontroller's Introduction

#BDDynamicGridViewController - Data-aware view-controller that displays a UIView list in an automatically laid out grid.

Data-aware view controller that displays a UIView list (typically, UIImageView list) in a row-dominated grid layout. This class automatically lay out the UIViews with help from a delegate class (which is supplier by you.) The class is inspired by the beautiful iCarousel class by Nick Lockwood

##Sample Screenshot (better viewed in the iOS demo project.)

These are sample layout of the same UIView list automatically laid out by this class.

##How to use ###Installation

  • Copy .h/.m files from the Classes folder into your code base

  • Or you can use Cocoapods, add the following line into your Podfile

    dependency 'BDDynamicGridViewController'

###Implementation ####BDDynamicGridViewController This is the main view controller initialized using init. Subclassing is recommended. Once initialized, set a delegate class to it. It receives delegate of type BDDynamicGridViewDelegate. See next.

One you have your delegate set up. Call reloadData to see the layout. Each call to reloadData creates a new layout.

Once the view is loaded. User can tap on each view. There are two gestures supported, namely, long press and double tap. These are configurable using blocks through the following properties: onLongPress and onDoubleTap. Each block call is supplied with the gesture-recognized UIView and its index corresponding to the index in the -viewAtIndex method.

####BDDynamicGridViewDelegate This is the delegate protocol needed by BDDynamicGridViewController. All methods are required to implement.

  • -numberOfViews returns the total count of UIViews to display.
  • -viewAtIndex: returns a UIView at an index specified.
  • -maximumViewsPerCell returns the maximum number of UIViews per row. BDDynamicGridViewController uses this method to determine how many UIViews it can fill in each row at the most.
  • -rowHeightForRowInfo BDDynamicGridViewController calls this method in order to set each row's height. The supplied rowInfo contains the information useful for the delegate to decide on the row height, such as, the number of UIViews contained in this row, etc.

That's it!

##Requirements

  • Requires ARC

##How to use

  • Be sure to checkout the latest tag, as opposed to the latest commit. Only tagged points are stable.

  • Include h/.m files in Classes folder to your source code

  • or use Cocoapods, add the following line into your Podfile

    dependency 'BDDynamicGridViewController'

  • Check out the iPhone demo. Read the comments. Send me questions, if any.

##Apps using BDDynamicGridViewController

##License BDDynamicGridViewController is licensed under BSD. More info in LICENSE file.

bddynamicgridviewcontroller's People

Watchers

 avatar  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.