Open legendashish opened 7 years ago
I tried to implement the controller in UIViewController's viewDidLoad,but it doesnot work. Kindly suggest!
(void)viewDidLoad { [super viewDidLoad];
UIStoryboard mainStoryBoard=[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; UIViewController leftView=[mainStoryBoard instantiateViewControllerWithIdentifier:@"LeftViewController"]; UIViewController centreView=[mainStoryBoard instantiateViewControllerWithIdentifier:@"VehicleMonitorViewController"]; UIViewController rightView=[mainStoryBoard instantiateViewControllerWithIdentifier:@"RightViewController"]; UINavigationController leftNav=[[UINavigationController alloc]initWithRootViewController:leftView]; UINavigationController centreNav=[[UINavigationController alloc]initWithRootViewController:centreView]; UINavigationController *rightNav=[[UINavigationController alloc]initWithRootViewController:rightView]; self.drawerController = [[MMDrawerController alloc]initWithCenterViewController:centreNav leftDrawerViewController:leftNav rightDrawerViewController:rightNav]; ;
[self.drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll]; [self.drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];
VehicleMonitorViewController *vc = [[VehicleMonitorViewController alloc] init];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:vc];
self.window.rootViewController = _drawerController;
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIColor * tintColor = [UIColor colorWithRed:29.0/255.0 green:173.0/255.0 blue:234.0/255.0 alpha:1.0];
[self.window setTintColor:tintColor]; [self.window setRootViewController:self.drawerController]; [self.drawerController toggleDrawerSide:MMDrawerSideLeft animated:YES completion:nil]; }
?? This should be done in AppDelegate not in the viewDidLoad of a given controller...
since anyway you are replacing the main window....
I tried to implement the controller in UIViewController's viewDidLoad,but it doesnot work. Kindly suggest!
(void)viewDidLoad { [super viewDidLoad];
UIStoryboard mainStoryBoard=[UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil]; UIViewController leftView=[mainStoryBoard instantiateViewControllerWithIdentifier:@"LeftViewController"]; UIViewController centreView=[mainStoryBoard instantiateViewControllerWithIdentifier:@"VehicleMonitorViewController"]; UIViewController rightView=[mainStoryBoard instantiateViewControllerWithIdentifier:@"RightViewController"]; UINavigationController leftNav=[[UINavigationController alloc]initWithRootViewController:leftView]; UINavigationController centreNav=[[UINavigationController alloc]initWithRootViewController:centreView]; UINavigationController *rightNav=[[UINavigationController alloc]initWithRootViewController:rightView]; self.drawerController = [[MMDrawerController alloc]initWithCenterViewController:centreNav leftDrawerViewController:leftNav rightDrawerViewController:rightNav]; ;
[self.drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll]; [self.drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];
VehicleMonitorViewController *vc = [[VehicleMonitorViewController alloc] init];
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:vc];
self.window.rootViewController = _drawerController;
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
UIColor * tintColor = [UIColor colorWithRed:29.0/255.0 green:173.0/255.0 blue:234.0/255.0 alpha:1.0];
[self.window setTintColor:tintColor]; [self.window setRootViewController:self.drawerController]; [self.drawerController toggleDrawerSide:MMDrawerSideLeft animated:YES completion:nil]; }