[英]MMDrawerViewController objective-c push to navigation view controller
我是iOS開發的初學者,我的應用帶有許多控制器。 登錄LoginViewController后(LoginViewController與NavigationViewController有聯系),我使用以下代碼初始化MMDrawerViewController:
-(void)initSidebarController{
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *leftView = [mainStoryboard instantiateViewControllerWithIdentifier:@"LeftViewController"];
UIViewController *centerView = [mainStoryboard instantiateViewControllerWithIdentifier:@"CenterViewController"];
UINavigationController *leftNav= [[UINavigationController alloc]initWithRootViewController:leftView];
UINavigationController *centerNav= [[UINavigationController alloc]initWithRootViewController:centerView];
appDelegate.drawerController= [[MMDrawerController alloc]initWithCenterViewController:centerNav leftDrawerViewController:leftNav];
appDelegate.drawerController.openDrawerGestureModeMask = MMOpenDrawerGestureModePanningCenterView;
appDelegate.drawerController.closeDrawerGestureModeMask = MMOpenDrawerGestureModePanningCenterView;
appDelegate.window.rootViewController = appDelegate.drawerController;
[appDelegate.window makeKeyAndVisible];
}
現在我想在用戶didSelectRowAtIndexPath時將DishesViewController推送到 NavigationViewController 上 。 如何正確執行此操作?
轉到情節提要,選擇dishsViewController並從左窗格中選擇身份檢查器,然后在StoryboardID中輸入“ dishesVC”,然后使用此代碼:
CateringDishesViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"dishesVC"];
[self.navigationController pushViewController: animated:YES]
請按照以下步驟操作,我相信它會為您服務。
1)獲取頂部ViewController
( 參考鏈接 )。
2)如果您的MMDrawerController庫配置正確,那么您將獲得MMDrawerController
作為頂視圖控制器。
3)然后找到中心的UINavigationController
4)通過使用中心導航控制器,您可以將新的視圖控制器放入堆棧中。
如果您無法執行此操作,請向我們提供示例源代碼。 因此,我們可以提供確切的解決方案。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.