生命周期顺序
//1-(void)loadView 加载内存
//2-(void)viewDidLoad 加载完成
//3-(void)viewWillAppear:(BOOL)animated 页面将要渲染到屏幕上
//4-(void)viewDidAppear:(BOOL)animated 页面已经渲染
//5-(void)viewWillDisappear:(BOOL)animated 页面将要消失
//6-(void)viewDidDisappear:(BOOL)animated 页面已经消失
//7-(void)didReceiveMemoryWarning 内存紧张
删掉storyboard、ViewController;删掉info里的storyboard。
AppDelegate里:
//初始化window
self.window = [[UIWindow alloc]init];
//初始化左侧边栏控制器
SGLeftMenuViewController *lvc = [[SGLeftMenuViewController alloc]initWithNibName:@"SGLeftMenuViewController" bundle:nil];
//初始化主视图控制器
MainViewController *mvc = [[MainViewController alloc]initWithNibName:@"MainViewController" bundle:nil];
//添加导航栏
UINavigationController *nc = [[UINavigationController alloc]initWithRootViewController:mvc];
//添加侧栏管理器 同时将设置侧边栏控制器和主视图控制器
MMDrawerController *dc = [[MMDrawerController alloc]initWithCenterViewController:nc leftDrawerViewController:lvc];
//使得侧边栏持有首页,及侧边栏管理器
lvc.mainNvc = nc;
lvc.mmd = dc;
//设置侧边栏属性
//设置左侧边栏宽度
[dc setMaximumLeftDrawerWidth:240.0];
//设置打开左侧边栏模式
[dc setOpenDrawerGestureModeMask:MMOpenDrawerGestureModePanningCenterView];
//设置关闭左侧边栏模式
[dc setCloseDrawerGestureModeMask:MMCloseDrawerGestureModePanningCenterView];
//弹出动画速度
[dc setAnimationVelocity:10000];
[dc setShouldStretchDrawer:NO];
//设置window的根视图控制器
self.window.rootViewController = dc;
// lvc.view.backgroundColor = [UIColor blueColor];
[self.window makeKeyAndVisible];