AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
SWRevealViewController *revealController = (SWRevealViewController *)delegate.window.rootViewController;
UIImage *img_menu = [UIImage imageNamed:first_icon];
UIButton *btn_menu = [UIButtonbuttonWithType:UIButtonTypeCustom];
btn_menu.frame = CGRectMake(frame.origin.x + 10, frame.origin.y+20, 40, 40);
[btn_menu setImage:img_menu forState:UIControlStateNormal];
[self.view addSubview:btn_menu];
[btn_menu addTarget:revealController action:@selector(revealToggle:) forControlEvents:UIControlEventTouchUpInside];
[self.view addGestureRecognizer:revealController.panGestureRecognizer];
开源类库和我做的简单的demo实现在网盘:http://yun.baidu.com/share/link?shareid=4254976037&uk=3793932076