IIViewDeckController is not working when push by navigation controller

397 Views Asked by At

Please help me in my project. I am using IIViewDeckController but its not working when pushed by view controller

Heres the hierarchy:

ViewController (Push)----> IIViewDeckController (with Left and centerview).

Here is my code when initialising the IIViewDeckController:

- (IIViewDeckController*)generateControllerStack{

self.navigationView = [[NavigationViewController alloc] initWithNibName:@"NavigationViewController" bundle:nil];
self.profileView = [[ProfileViewController alloc] initWithNibName:@"ProfileViewController" bundle:nil];

UINavigationController* navC = [[UINavigationController alloc] initWithRootViewController:self.profileView];


IIViewDeckController *deckView = [[IIViewDeckController alloc] initWithCenterViewController:navC leftViewController:self.navigationView rightViewController:nil];

deckView.leftSize = 50;

[deckView disablePanOverViewsOfClass:NSClassFromString(@"_UITableViewHeaderFooterContentView")];

return deckView;

}

then this is my code when I'm pushing IIViewDeckController using another ViewController

- (IBAction)signInAction:(id)sender {

IIViewDeckController *deckView = [[UIManager sharedItems] generateControllerStack];

[self.navigationController pushViewController:deckView animated:YES];

}

Thanks you very much guys :)

enter image description here

when I clicked sign in which is I will push my iiviewdeckcontroller with left and centre view this appears

enter image description here

3

There are 3 best solutions below

0
On

You can do like that.

//Appdelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController"
                                                       bundle:nil];
UINavigationController *navigation = [[UINavigationController alloc]initWithRootViewController:self.viewController];
self.window.rootViewController = navigation;
[self.window makeKeyAndVisible];
return YES;

}

import IIViewDeckController.h in ViewController.h then

- (IBAction)GoToNext:(id)sender 
{
        IIViewDeckController *objIIVC = [self.storyboard instantiateViewControllerWithIdentifier:@"Your VC's Identifier"];
        [self.navigationController pushViewController:objIIVC animated:YES];

}
3
On

Did you created it like this? I am using it as root view controller. and it is working fine

    UINavigationController* navController=(UINavigationController*)[[UIStoryboard storyboardWithName:@"Main" bundle: nil] instantiateViewControllerWithIdentifier:@"HomeViewController"];

    SlideMenuViewController* slide=[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"SlideMenuViewController"]; /


    IIViewDeckController* deckController =  [[IIViewDeckController alloc] initWithCenterViewController:navController
                                                                                    leftViewController:slide
                                                                                   rightViewController:nil
                                                                                     topViewController:nil
                                                                                  bottomViewController:nil];

    float leftSize=self.window.frame.size.width - (88*self.window.frame.size.width)/320;
    deckController.panningMode = IIViewDeckFullViewPanning;
    deckController.leftSize =leftSize;
2
On

Here is my code

- (IIViewDeckController*)generateControllerStack{

self.navigationView = [[NavigationViewController alloc] initWithNibName:@"NavigationViewController" bundle:nil];


UIViewController *centerController = [[ProfileViewController alloc] initWithNibName:@"ProfileViewController" bundle:nil];
centerController = [[UINavigationController alloc] initWithRootViewController:centerController];


self.viewDeck = [[IIViewDeckController alloc] initWithCenterViewController:centerController leftViewController:self.navigationView rightViewController:nil topViewController:nil bottomViewController:nil];

self.viewDeck.leftSize = 50;

[self.viewDeck disablePanOverViewsOfClass:NSClassFromString(@"_UITableViewHeaderFooterContentView")];

return self.viewDeck;

}