导航栏抽屉视图
- Drag
ACNavBarDrawer.h
&ACNavBarDrawer.m
into your project. - Add QuartzCore framework to your project.
#import "ACNavBarDrawer.h"
//-- 先创建按钮信息 ------------------------------------------------------------------
// 小数组第一个为图片名、第二个为按钮名
NSArray *allItems = @[@[@"drawer_msg", @"button1"],
@[@"drawer_msg", @"button2"],
@[@"drawer_msg", @"button3"],
@[@"drawer_msg", @"button4"]];
/** 初始化 */
_drawerView = [[ACNavBarDrawer alloc] initWithView:self.view andItemInfoArray:allItems];
// 打开抽屉
[_drawerView openNavBarDrawer];
// 收起抽屉
[_drawerView closeNavBarDrawer];
// 实现 <ACNavBarDrawerDelegate> 协议
// 设置代理对象
_drawerView.delegate = self;
// 抽屉上按钮事件的回调
-(void)didTapButtonAtIndex:(NSInteger)itemIndex
{
NSLog(@"Button %d is clicked.", (itemIndex + 1));
switch (itemIndex)
{
case 0:
{
}
break;
// ... 此处省略
default:
break;
}
}
// 可选回调 抽屉视图将要关闭时 的处理
-(void)drawerWillClose
{
}
- ARC
- iOS 6/7
MIT