CDSideBarController is a light and easy side bar with custom iOS7 animations and actions
How does it work ?
-
Import CDSideBar/CDSideBarController in your project
-
.h file
2.1 - #import "CDSideBarController.h" in the header file
2.2 - Add delegate
2.3 - Add CDSideBarController *sideBar in your interface
Should look like this:
#import "CDSideBarController.h"
@interface ViewController : UIViewController
{
CDSideBarController *sideBar;
}
- .m file
3.1 - In viewDidLoad, create a NSArray that contains your menu images
3.2 - Create your instance of CDSideBarController with this array
3.3 - Set self as a delegate to this instance
Should look like this:
NSArray *imageList = @[[UIImage imageNamed:@"menuChat.png"], [UIImage imageNamed:@"menuUsers.png"], [UIImage imageNamed:@"menuMap.png"], [UIImage imageNamed:@"menuClose.png"]]; sideBar = [[CDSideBarController alloc] initWithImages:imageList];
sideBar.delegate = self;
3.4 - Add the delegate method to be notified each time a menu button is clicked
- (void)menuButtonClicked:(int)index
{
// Execute what ever you want
}
- (void)menuButtonClicked:(int)index
3.4 - Once you want the sidebar appear, just add :
[sideBar insertMenuButtonOnView:self.view atPosition:CGPointMake(self.view.frame.size.width - 70, 50)];
AtPosition correspond to the position where the show/hide menu button will be displayed
You're all set!