TheSidebarController
TheSidebarController copied to clipboard
Modal presentation issue
Presenting a modal view controller from either TheSidebarController or the main content controller works, but when the modal view controller is dismissed, TheSidebarController (and the sidebar and main content controller) are no longer visible, and all that's left is the UIWindow background color.
I've tried this multiple times and seem to be able to replicate it 100% of the time.
Ideally, I'd like to be able to get the top most view controller (TheSidebarController in this case) and present a modal view controller from it, without any problems.
EDIT: This issue affects both iOS 7 and iOS 8.
I can’t seem to see your comment on the GitHub page, but no, I can’t present a modal view controller from self.sideBarController or the contentViewController.
— Pauli Jokela
Jon Danao [email protected], wrote: Hi @Dids
Can you present the modal from [self.sidebarController presentViewController.....]?
Jon
I got the same issue. Is this issue fixed? @Dids did you find a solution for it?
@ngoccuong291
This library doesn't seem to be well maintained, so I gave up on it, after not being able to track down exactly what causes the issue.
My solution was to move to a more maintained a lot more stable solution: https://github.com/John-Lluch/SWRevealViewController
@Dids Thanks, I will give it a try when I have free time but at the moment, I will also need to choose a stable solution.
I found a way to avoid this problem - in your app delegate, didFinishLaunchingWithOptions add this [[self window] addSubview:sidebarController.view]
.
The 'window' set block should look like this:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor blackColor];
[[self window] setRootViewController:sidebarController];
[[self window] addSubview:sidebarController.view]; // THIS!
[self.window makeKeyAndVisible];
It solved the problem for me.
Thanks @joaofranca I can confirm that the hack worked but I'm not 100% sure about the side effect of this hack because from iOS 4, Apple encouraged developers to set the rootViewController instead of addSubView to UIWindow. For now, everything is good.
This hack doesn't work for me (just leaves me with a black window). I'm stuck on this as well after several hours debugging led me here.
Discovered "storyboardsUseAutoLayout" BOOL -- solved my issue. Not that I'm using storyboards..!
storyboardsUseAutoLayout to YES appears to break rotation.
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.backgroundColor = [UIColor blackColor]; [[self window] setRootViewController:sidebarController]; [[self window] addSubview:sidebarController.view]; // THIS! [self.window makeKeyAndVisible];
It solved the problem for me.
did you try with? sidebarController.translatesAutoresizingMaskIntoConstraints = YES;
That worked for my
@joaofranca now that you have solved this problem,do you know why does work?