ios 8 change the size of presented/modal view controller

前端 未结 3 706
执念已碎
执念已碎 2020-12-14 04:27

In ios 7 and before, I was updating the bounds of presentedViewController.view.superview to custom the size of presented view controller, but it seems this would not be the

3条回答
  •  余生分开走
    2020-12-14 04:48

    I guess the following is easier and it works in iOS 8:

    self.myViewController.modalPresentationStyle = UIModalPresentationFormSheet;
    self.myViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    
    //This will be the size you want
    self.myViewController.preferredContentSize = CGSizeMake(822, 549);
    
    [self presentViewController:self.myViewController animated:YES completion:nil];
    

提交回复
热议问题