iosmenuresizeautoresizingmask

MFSideMenu - center view doesn't resize


I'm using MFSideMenu following the setup instructions, putting in didFinishLaunchingWithOptions this code:

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
SideMenuViewController *leftMenuViewController = [[SideMenuViewController alloc] init];
SideMenuViewController *rightMenuViewController = [[SideMenuViewController alloc] init];
MFSideMenuContainerViewController *container = [MFSideMenuContainerViewController
                                                containerWithCenterViewController:[self demoController]
                                                leftMenuViewController:leftMenuViewController
                                                rightMenuViewController:rightMenuViewController];
self.window.rootViewController = container;
[self.window makeKeyAndVisible];

return YES;

I have tested this in demo project MFSideMenuDemoBasic, replacing [self navigationController] with [self demoViewController] simply because I don't want to use a navigation controller. The problem is that the center view controller doesn't resize properly, it remains the same size also if running on iPad. I'm having the same behaviour in my project and probably I'm missing something obvious.


Solution

  • add this to your demoController's viewDidLoad method (it worked for me):

    self.view.frame = [[UIScreen mainScreen] bounds];
    

    verify your view has autosizing set correctly...