Question

I've been trying to solve this issue for the past couple of hours, searched SO and still to no avail.

I have a UIViewController which has a Container view inside (dragged in from Storyboards). The container view has a class associated that picks one of two other view controllers to display.

-(void)setDisplayMode:(EventsDisplayMode)displayMode {
switch (displayMode) {
    case EventsDisplayModeGrid: {
        // show grid
        if (!gridViewController) {
            gridViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"gridViewController"];
        }
        [UIView animateWithDuration:0.8 delay:0 options:UIViewAnimationOptionTransitionFlipFromLeft animations:^{
            if (listViewController)
                [listViewController.view removeFromSuperview];
            gridViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
            [self.view addSubview:gridViewController.view];
            listViewController = nil;
        } completion:^(BOOL finished) {

        }];

        break;
    }
    case EventsDisplayModeList: {
        // show list
        if (!listViewController)
            listViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"listViewController"];
        [UIView animateWithDuration:0.8 delay:0 options:UIViewAnimationOptionTransitionFlipFromLeft animations:^{
            if (gridViewController)
                [gridViewController.view removeFromSuperview];
            [self.view addSubview:listViewController.view];
            gridViewController = nil;
        } completion:^(BOOL finished) {


        }];


        break;
    }
}
}

The above is the code in the container view controller. When either mode is set though, the view bleeds off the bottom of the screen on an iPhone 5s slightly, and on an iPhone 4S it's as though the view inside hasn't resized at all for the device. I've tried all sorts of combinations to resize the views - setting up constrains inside Storyboards for each of the controllers, manually taking off amounts from the height of views - nothing seems to work. Is there something obvious I'm missing?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top