我有一个应用程序,只使用西克斯,没有故事板。
我已经创建了一个提示xib,我希望从一个表视图控制器xib (名为TVC.xib)中以模态动画的方式显示TVC是嵌套在导航控制器中的。
我可以得到提示显示自己,但我希望它呈现自己的模态动画。不幸的是,presentModalViewController已经被否决了。当前的选项是什么,以代码的方式呈现视图控制器,并使其以与模态演示使用的动画相同的方式动画?
这是我的代码:(在TVC.m中)
PromptViewController *promptVC = [[PromptViewController alloc] initWithNibName:@"PromptXib" bundle:nil];
UINavigationController *navVC = [[UINavigationController alloc] initWithRootViewController:promptVC];
[self.navigationController presentViewController:navVC animated:YES completion:^{
NSLog(@"presented prompt vc");
}];理想情况下,我可以用self.navigationController presentMODALViewController替换第3行中的方法.等等,但这是不可取的。
发布于 2015-08-04 18:52:22
我已经想明白了。我需要在我想要显示的视图控制器上设置转换样式和表示样式。这是我的解决方案:
PromptViewController *promptVC = [[PromptViewController alloc] initWithNibName:@"PromptXib" bundle:nil];
promptVC.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
promptVC.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:promptVC animated:YES completion:nil];发布于 2015-08-04 17:24:26
你在寻找:
[self presentViewController:aViewController animated:animated completion:^{}];
但是,您应该浏览一些教程来更新知识。
https://stackoverflow.com/questions/31815370
复制相似问题