Objective c 显示模态视图控制器

Objective c 显示模态视图控制器,objective-c,modalviewcontroller,Objective C,Modalviewcontroller,我有这个: SomeViewController* vc = [[SomeViewController alloc] init]; self.view.backgroundColor = [UIColor clearColor]; self.modalPresentationStyle = UIModalPresentationCurrentContext; [self presentModalViewController:vc animated:YES]; 出现空白黑屏-如何修复?有什么想法

我有这个:

SomeViewController* vc = [[SomeViewController alloc] init];
self.view.backgroundColor = [UIColor clearColor];
self.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentModalViewController:vc animated:YES];

出现空白黑屏-如何修复?有什么想法吗?

这似乎不是视图控制器的有效初始值设定项。use–initWithNibName:bundle:如果您的子类是UIViewController的一个直接子类,但在这里的聚会上迟到了一点,但是如果您正在使用UINavigationController从vc初始化此模式视图控制器,请尝试在UINavigationController上设置modalPresentationStyle:

self.navigationController.modalPresentationStyle = UIModalPresentationCurrentContext;

您的类是UIViewcontroller的直接子类,还是UITableViewController的直接子类?您是否使用了正确的nib名称?UIViewcontroller或UITableViewController?我认为问题可能是nib名称。确保您的笔尖已正确加载。代码中还有其他问题。您不是在设置SomeViewController的模式显示样式,而是在设置self的模式显示样式和self的视图背景颜色。