我想将不受控制的视图填充为我的应用程序上的presentViewController,但它不起作用。我不想覆盖整个屏幕。像在iPad上一样,它应该在中心和框架处查看,这是首选。

下面是我的代码,它覆盖了整个屏幕:

MyView *testview = [[MyView alloc]init];
testview.modalPresentationStyle = UIModalPresentationFormSheet;
testview.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController: testview animated:YES completion:nil];


我不想推送我的UIViewController ...

最佳答案

您无法显示视图。您必须提供一个控制器。例如:

 UIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle: nil];
    MyViewController* vc = [mainStoryboard instantiateViewControllerWithIdentifier:@"MY_CTL_ID"];
    [self  presentViewController:vc animated:NO completion:nil];

10-08 07:48