標籤:
生命週期順序
//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];
藍懿教育 生命週期 刪掉storyboard