2016-09-07 4 views
0

MMDrawerを実装して左のドロワーを実装しようとしていますが、1つのビューコントローラのみで、ルートコントローラではありません。私はAppDelegate.h既存のナビゲーションコントローラ内でMMDrawerを使用する

@property (strong, nonatomic) MMDrawerController *drawer; 

Using MMDrawer only in sub navigation view

-(void) signInButtonListener:(UIButton *)button{ 

    UIViewController * leftDrawer = [[leftDrawerViewController alloc] init]; 
    UIViewController * center = [[centreViewController alloc] init]; 

    MMDrawerController * drawerController = [[MMDrawerController alloc] 
         initWithCenterViewController:center 
         leftDrawerViewController:leftDrawer 
         rightDrawerViewController:nil]; 

[drawerController setShowsShadow:NO]; 
[drawerController setRestorationIdentifier:@"MMDrawer"]; 
[drawerController setMaximumRightDrawerWidth:200.0]; 
[drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll]; 
[drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll]; 

[drawerController 
setDrawerVisualStateBlock:^(MMDrawerController *drawerController, MMDrawerSide drawerSide, CGFloat percentVisible) { 
    MMDrawerControllerDrawerVisualStateBlock block; 
    block = [[MMExampleDrawerVisualStateManager sharedManager] 
       drawerVisualStateBlockForDrawerSide:drawerSide]; 
    if(block){ 
     block(drawerController, drawerSide, percentVisible); 
    } 
}]; 

landingPageViewController *landingPageController = [UBNLandingPageViewController new]; 
[myNavigator pushViewController:drawerController animated:YES]; 
} 

答えて

0

に引き出し、センタービュー

を去った別のビューコントローラとほぼ同様の質問をリダイレクトすることができるはず、ログインボタンをクリックするだけで AppDelegate.mファイル内 内部:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 




UIStoryboard *mainstory=[UIStoryboard storyboardWithName:@"Main" bundle:nil]; 

UIViewController * leftDrawer = [mainstory instantiateViewControllerWithIdentifier:@"MenuTableViewController"]; 

     UIViewController * center = [mainstory instantiateViewControllerWithIdentifier:@"HomeViewController"]; 

    UINavigationController *leftnav=[[UINavigationController alloc]initWithRootViewController:leftDrawer]; 
     UINavigationController *homnav=[[UINavigationController alloc]initWithRootViewController:center]; 
//drawer is the object for MMDrawerController 
drawer=[[MMDrawerController alloc]initWithCenterViewController:homnav leftDrawerViewController:leftnav rightDrawerViewController:nil]; 

//書かないでください

_window.rootViewController = drawController; [_window makeKeyAndVisible];書く場合は にコメントしてください。

ウルLoginButtonAction

インポートAppDelegate.hファイルで

と、これらの線の内側に書き込み、その後Uは、次のページのように、中心ビューを取得します。

AppDelegate *app=(AppDelegate *)[[UIApplication sharedApplication]delegate]; 
    app.window.rootViewController = app.drawer; 
    [app.window makeKeyAndVisible]; 
関連する問題