如何更改模式对话框的大小?为什么这不起作用?

SlingDialogViewController *slingDialog = [[SlingDialogViewController alloc] init];

    slingDialog.modalPresentationStyle = UIModalPresentationFormSheet;
    slingDialog.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    slingDialog.view.superview.frame = CGRectMake(0, 0, 900, 700);
    [self presentModalViewController:slingDialog animated:YES];

最佳答案

做这个:

SlingDialogViewController *slingDialog = [[SlingDialogViewController alloc] init];

slingDialog.modalPresentationStyle = UIModalPresentationFormSheet;
slingDialog.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

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

slingDialog.view.superview.frame = CGRectMake(0, 0, 900, 700);
slingDialog.view.superview.center = self.view.center;

至少从我的经验来看,首先调用presentViewController:animated:completion很重要。

09-12 20:40