Giter Club home page Giter Club logo

icsdrawercontroller's Introduction

ICSDrawerController

ICSDrawerController is a left-side drawer controller for iPhone (iOS 7 or later).

It has all the features you'd expect from a side drawer controller, plus it's small, easy to read and tailor to your needs.

demo

The controller is designed as a container controller and accepts two child controllers: the left and the center view controllers. The left view controller is intended as a master view controller: it is visible only when the drawer is open and, typically, talks to the drawer in order to update/replace the center view controller. The center view controller is intended as a detail view controller: it is visible when the drawer is closed and typically sends the open message to the drawer to reveal the left side controller.

Opening/closing the drawer

ICSDrawerController uses a UIPanGestureRecognizer to open/close the drawer and a UITapGestureRecognizer to close the drawer by tapping anywhere on the visible part of the center view controller.

It is left to your center view controller to provide a button and call open on the drawer controller. (From your child controllers you access the drawer controller by adopting the ICSDrawerControllerChild protocol and implementing the required drawer property.)

Status bar

You can control the status bar's visibility and style by implementing, in each one of your child controllers, the prefersStatusBarHidden and preferredStatusBarStyle methods made available by iOS 7.

Getting notified when the drawer state changes

The drawer controller will notify its child controllers by sending:

  • the message drawerControllerWillOpen: when the drawer is about to open
  • the message drawerControllerDidOpen: when the drawer has completed the opening phase
  • the message drawerControllerWillClose: when the drawer is about to close
  • the message drawerControllerDidClose: when the drawer has completed the closing phase

Installing

  1. Drag the inner ICSDrawerController folder to your Xcode project
  2. Adopt in your child controllers the ICSDrawerControllerChild protocol and implement its the required drawer property
  3. Adopt in your child controllers the ICSDrawerControllerPresenting protocol
  4. Initialize the drawer controller with your left view controller and your initial center view controller:
YourLeftViewController *left = [[YourLeftViewController alloc] init];
YourCenterViewController *center = [[YourCenterViewController alloc] init];
ICSDrawerController *drawer = [[ICSDrawerController alloc] initWithLeftViewController:left
                                                                 centerViewController:center];

For a concrete example on how to use this controller, have a look at the provided Colors project.

About

ICSDrawerController was built to be used in our app Remember the Tripod, brought to you by Ludovico Rossi and Vito Modena at ice cream studios (also developers of Writings for iPad and Stories for iPhone). You can drop us a line at [email protected].

License

ICSDrawerController and the Colors example are made available under the MIT License.

icsdrawercontroller's People

Contributors

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