Ok, I found a dirty solution but that fixed the problem.
I have the following configuration
NavigationController -> UIViewController -[Modal]-> UINavigationController -> UIViewController1 -[Push]-> UIViewController2 (check the screenshot above).
Now the idea is to resize the ModalView (I force landscape mode, so portrait is not supported but you can easily modify the code). I have a singletton class that contain useful methods, I called AppKit.
In AppKit.m :
#pragma mark - Window functions (modal, ...)
/**
* Cette méthode redimmensionne une modal view en type PaperSheet.
* Utilisé dans le viewDidAppear du controller enfant.
* Permet de mettre des modal view en fullscreen.
*
* @param id viewController Le viewController parent
*/
- (void)resizeModalToPaperSheet:(id) viewController {
// Adaptation de la taille de la fenêtre pour iPad
if (isIPad) {
[viewController navigationController].view.superview.center = CGPointMake(0.0f, 0.0f);
[viewController navigationController].view.superview.frame = CGRectMake(84.0f, 242.0f, 540.0f, 540.0f);
}
}
/**
* Cette méthode redimmensionne une modal view en type FullScreen.
* Utilisé dans le viewDidAppear du controller enfant.
* Permet de mettre des modal view en fullscreen.
*
* @param id viewController Le viewController parent
*/
- (void)resizeModalToFullScreen:(id) viewController {
// Adaptation de la taille de la fenêtre pour iPad
if (isIPad) {
[viewController navigationController].view.superview.center = CGPointMake(0.0f, 0.0f);
[viewController navigationController].view.superview.frame = CGRectMake(20.0f, 0.0f, 754.0f, 1024.0f);
}
}
Now in my sub viewcontrollers I have to call the method two times (else when you press back the size of the modalview is keeped from the previous controller, so you have to put it in viewDidAppear).
ViewController 1 (PaperSheet size) :
-(void) viewWillAppear:(BOOL)animated {
[[AppKit sharedInstance] resizeModalToPaperSheet: self];
}
-(void) viewDidAppear:(BOOL)animated {
[[AppKit sharedInstance] resizeModalToPaperSheet: self];
}
ViewController 1 (FullScreen size) :
-(void) viewWillAppear:(BOOL)animated {
[[AppKit sharedInstance] resizeModalToFullScreen: self];
}
-(void) viewDidAppear:(BOOL)animated {
[[AppKit sharedInstance] resizeModalToFullScreen: self];
}
And it works pretty good ; I can easily switch between fullscreen and PaperSheet.
Now there is one remaining problem : On the storyboard, view is still small, and it's not easy to add stuff inside. So you have to do this :
1/ In the storyboard, click on the view controller which is to small (box icon)
2/ On the attributes panel, set the size to iPad fullscreen
Hope this helps, any comment on how to improve the code is welcome :)