I am using ViewDeck to power the sliding UI in my iPad app but i'm hitting a few problems.
I want to size the leftViewController to a specific size regardless of the rotation. The code I have to setup ViewDeck is as follows oh and i'm using storyboards.
- (id)initWithCoder:(NSCoder *)aDecoder
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UINavigationController *navigationController = [storyboard instantiateViewControllerWithIdentifier:@"leftViewController"];
JWTimerGroupsViewController *timerGroupsViewController = navigationController.viewControllers[0];
IISideController *constrainedSizeLeftViewController = [[IISideController alloc] initWithViewController:navigationController];
JWMainTableViewController *middleViewController = (JWMainTableViewController *)[storyboard instantiateViewControllerWithIdentifier:@"middleViewController"];
[timerGroupsViewController setDelegate:middleViewController];
self = [super initWithCenterViewController:middleViewController leftViewController:constrainedSizeLeftViewController];
self.centerhiddenInteractivity = IIViewDeckCenterHiddenNotUserInteractiveWithTapToClose;
/* This below IS NOT the size of the left view controller? Just seems odd that it isn't */
[super setLeftSize:200];
[super setSizeMode:IIViewDeckViewSizeMode];
if (self) {
// Add any extra init code here
}
return self;
}
The setLeftSize appears to set the topViewControllers width? Which then makes the left view controller size inconsistent when rotating.
Also I'm seeing some really terrible blocky shadows when the topVC is opened and then the device is rotated.
Is it possible to fix the size of the left ViewController and the amount the top VC opens in ViewDeck?
EDIT
I have just found a reference to this method:
IISideController *constrainedSizeLeftViewController = [[IISideController alloc] initWithViewController:navigationController constrained:200];
Which DOES constrain the left viewcontroller to a specific value. But now there is still no way to have the top VC open to that width?!
You could try the approach suggested here: https://stackoverflow.com/a/16484446/928209
Basically it is:
Here is my code:
When I tried this approach coding in my IIViewDeckController after loading my storyboard, I found that a lot of my problems with view sizing went away. Before, for example, in order to make the side view a fixed width I had to set the leftSize property to (screenWidth - width) instead of the actual "width" I wanted. Once I made the IIViewDeckController the rootViewController of the app not via the storyboard but instead in code in my AppDelegate, I could set the fixed size to "width" and it worked properly.