我是初级 iOS 开发人员,正在尝试使用 MMDrawerController。
我的 MainStoryboard
有 4 个 View 。
- NavigationController(嵌入 CenterViewController Controller )
- 中心 View Controller
- 左 View Controller
- 关于ViewController
我在 CenterViewController
上的导航左侧项目上添加了按钮,然后点击它打开/关闭我的侧边菜单。
但是如果我不想用此代码更改中心 View
ViewController *vc = [mainStoryboard instantiateViewControllerWithIdentifier:@"AboutViewController"];
if (vc)
[appDelegate.drawerController setCenterViewController:vc withCloseAnimation:YES completion:nil];
它工作正常,但我没有导航左侧按钮。为什么?
谢谢
最佳答案
我的解决方案是:
AboutViewController *vc = [mainStoryboard instantiateViewControllerWithIdentifier:@"AboutViewController"];
if (vc)
{
if ( [appDelegate.drawerController.centerViewController isKindOfClass:[UINavigationController class]] )
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
UINavigationController *navController = (UINavigationController *)appDelegate.drawerController.centerViewController;
[appDelegate.drawerController toggleDrawerSide:MMDrawerSideLeft animated:YES completion:nil];
[navController pushViewController:vc animated:YES];
}
}
关于ios - MMDrawerController 我需要在哪里添加 sidemen 按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54680874/