ios - MMDrawerController 我需要在哪里添加 sidemen 按钮?

标签 ios objective-c xcode mmdrawercontroller

我是初级 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/

相关文章:

objective-c - 为什么 NSJSONSerialization 使用 NSData 而不是 NSString?

ios - Swift 'fabs' 已弃用 : renamed to 'abs'

iphone - 如何向 map View 添加多个颜色图钉。

ios - 如何比较我当前位置的纬度和日志(以 3 英里为半径)? Xcode

ios - 在不知道 UUID 的情况下检测 iBeacon。一些应用程序正在这样做

iphone - 在 iOS 中更快地将图像上传到服务器

objective-c - 为什么类别不能有实例变量?

ios - 按“后退”按钮执行 segue

javascript - window.close() 和 iOS

ios - CCCrypto解密: exactly one block less