侧边栏效果
appDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; // 侧滑菜单效果 MRMenu *menu = [[MRMenu alloc] init]; MRContentViewController *contentVC = [[MRContentViewController alloc] init]; MRContentNavigationController *contentNavigationController = [[MRContentNavigationController alloc] initWithRootViewController:contentVC]; MVYSideMenuOptions *options = [[MVYSideMenuOptions alloc] init]; MVYSideMenuController *sideMenuController = [[MVYSideMenuController alloc] initWithMenuViewController:menu contentViewController:contentNavigationController options:options]; sideMenuController.view.backgroundColor = [UIColor whiteColor]; // 设置菜单控制器为窗口的跟控制器 self.window.rootViewController = sideMenuController; // 设置窗口为主窗口 [self.window makeKeyAndVisible]; return YES; }
需要使用一下第三方框架:MVYSideMenu