0

如何将MMDrawerController用于我的主从应用程序?

我想要DetailViewControlleras mycenterViewControllerMasterViewControlleras a leftDrawerViewController


其实这是我的代码:

AppDelegate.m

#import "AppDelegate.h"
#import "MMDrawerController.h"
#import "MMDrawerVisualState.h"
#import "MasterViewController.h"
#import "DetailViewController.h"

@interface AppDelegate ()
@property (nonatomic,strong) MMDrawerController * drawerController
@end

@implementation AppDelegate

-(BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:              (NSDictionary *)launchOptions{
     UIViewController * leftDrawer = [[MasterViewController alloc] init];
     UIViewController * center = [[DetailViewController alloc] init];


     UINavigationController * navigationController = [[UINavigationController alloc] initWithRootViewController:center];
     [navigationController setRestorationIdentifier:@"MMExampleCenterNavigationControllerRestorationKey"];

     self.drawerController = [[MMDrawerController alloc]
                         initWithCenterViewController:center
                         leftDrawerViewController:leftDrawer];
     [self.drawerController setRestorationIdentifier:@"MMDrawer"];
     [self.drawerController setMaximumRightDrawerWidth:200.0];
     [self.drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
     [self.drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];

     self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
     [self.window setRootViewController:self.drawerController];
     // Override point for customization after application launch.
     self.window.backgroundColor = [UIColor whiteColor];
     [self.window makeKeyAndVisible];

     return YES;
}

centerViewController 保持完全黑色,而 leftDrawerViewController 仅包含一个 tableView。

4

1 回答 1

0

当您创建MMDrawerController尝试将initWithCenterViewController参数设置为navigationController而不是center.

于 2013-12-28T23:31:08.293 回答