ICSDrawerController is a left-side drawer controller for iPhone (iOS 6 or later). Backwards-compatibility has been added for use in real-world projects.
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.
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.
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.)
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.
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
- Drag the inner ICSDrawerController folder to your Xcode project
- Adopt in your child controllers the
ICSDrawerControllerChild
protocol and implement its the requireddrawer
property - Adopt in your child controllers the
ICSDrawerControllerPresenting
protocol - 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.
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 opensource@icecreamstudios.com.
iOS6 Support Added and maintained by David Benko. This version will continue to be a standalone fork from the original project.
ICSDrawerController and the Colors example are made available under the MIT License.