IIViewDeckController with left always showing on iPad

1.4k Views Asked by At

I am using IIViewDeckController and I would like to always have the left side controller open and resize the center view so that the layout looks similar to UISplitViewController.

According to the docs:

It is possible to have the viewController always show a side controller. You do this by setting the maxSize value to any (positive) nonzero value. This will force the centerview to be always opened, exposing a side controller permanently. This only works when you have ONE sidecontroller specified (this means either a left side controller or a right side controller), because this scenario does not make sense if you would be able to slide the center view in both directions. When you have 2 side controllers, this property is ignored.

I have done exactly what it says, but it will not always show the side controller:

PUCNews *news = [[PUCNews alloc] init];
UINavigationController *newsNav = [[UINavigationController alloc] initWithRootViewController:news];
[puc.cachedViewControllers setObject:newsNav forKey:@"news"];
PUCLeftNavigationViewController *leftNav = [[PUCLeftNavigationViewController alloc] init];
IIViewDeckController *deckController = [[IIViewDeckController alloc] initWithCenterViewController:newsNav leftViewController:leftNav];
deckController.openSlideAnimationDuration = 0.20f;
deckController.closeSlideAnimationDuration = 0.20;
deckController.centerhiddenInteractivity = IIViewDeckCenterHiddenNotUserInteractiveWithTapToClose;
deckController.elastic = NO;
if ([Utility isIpad]) {
    //deckController.leftSize = 200;
    deckController.maxSize = 500;
    //deckController.sizeMode = IIViewDeckLedgeSizeMode;
    [deckController toggleLeftViewAnimated:NO];
    deckController.centerhiddenInteractivity = IIViewDeckCenterHiddenUserInteractive;
    deckController.resizesCenterView = YES;
    deckController.panningMode = IIViewDeckNoPanning;
}

This also is causing some very strange rotation issues.

How can I always have the left side controller open and resize my center view so that it fits within the rest of the screen?

1

There are 1 best solutions below

2
On BEST ANSWER

I've used this,

self.leftController = leftController;
self.leftSize = 700;
[self openLeftViewAnimated:NO];

this works for me because I want a small space in the left size. Probably you need to play with the size afterwards, but this works!

Hope it helps you.

Cheers