0
我如何使用MMDrawerController爲我的主 - 細節應用程序?MMDrawerController - 如何爲主 - 細節SideBar
我想DetailViewController
作爲我的centerViewController
和MasterViewController
作爲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。
你的代碼似乎沒有問題。我在一個測試應用中實現了它,它顯示得很好。你檢查了中心視圖屬性來調查中心控制器顯示爲黑色嗎? – akdsouza