简体   繁体   中英

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?

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));

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM