Search code examples
uitableviewios8uimodalpresentationstyleuimodalpresentationcustom

UITableView not interacting after modyifing the bounds on a UIModalPresentationCustom


Basically, I am trying to present a custom modal view with a specific size and position since I was able to manage this through popover on iOS 7. But on iOS it seems they change things.

I manage to achieve this with the following:

Presentation:

            UpViewController *upViewController = [[UpViewController alloc] init];
            upViewController.delegate = self;

            UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:upViewController];

            navigationController.modalPresentationStyle = UIModalPresentationCustom;

            [self presentViewController:navigationController animated:YES completion:nil];

In UpViewController.m:

- (void)viewWillLayoutSubviews
{
    [super viewWillLayoutSubviews];

    self.navigationController.view.superview.bounds = CGRectMake(-350, -30, 320, screenSize.height-(44+20));

}

My problem is after my modal view has been presented. We cannot interact with the UITableView that has been added to the view. Anyone has encounter this problem?


Solution

  • Seems I found my own solution instead of setting the bounds, I set the navigationController.view.frame:

    - (void)viewWillLayoutSubviews
    {
        [super viewWillLayoutSubviews];
    
        self.navigationController.view.frame = CGRectMake(screenSize.width-320, 44, 320, screenSize.height-(44));
    
    }