我正在设置self.window.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
在我的应用程序委托中,以便我可以呈现视图控制器并使视图透明(请参阅此SOquestion).
这很好用,唯一需要注意的是,当视图控制器出现时我无法设置动画。有人让它发挥作用吗?如果没有,我还有什么其他选择?
我展示的视图控制器是一个“演练”,其中包含UIScrollView
and UIPageControl
它应该“悬停”在界面上,这样您就可以在边缘稍微看到它的背景。
我最终这样做了:
AppDelegate *appDelegate = [AppDelegate sharedAppDelegate];
// Set the root VC modal presentation style
appDelegate.window.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
WalkthroughViewController *walkthroughVC = [[WalkthroughViewController alloc] initWithNibName:nil bundle:nil];
[self presentViewController:walkthroughVC animated:NO completion:nil];
// Manually animate the view
walkthroughVC.view.alpha = 0;
[UIView animateWithDuration:0.5 animations:^{
walkthroughVC.view.alpha = 1;
}];
// Reset root VC modal presentation style
appDelegate.window.rootViewController.modalPresentationStyle = UIModalPresentationFullScreen;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)