presenting透明度和动画视图控制器 [英] Presenting a view controller with transparency and animation

查看:144
本文介绍了presenting透明度和动画视图控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设置 self.window.rootViewController.modal presentationStyle = UIModal presentationCurrentContext; 在我的应用程序委托,这样我可以present一个视图控制器,而且认为是透明的(见本SO <一个href=\"http://stackoverflow.com/questions/587681/how-to-use-$p$psentmodalviewcontroller-to-create-a-transparent-view\">question).

I'm setting self.window.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext; in my Application Delegate so that I can present a view controller and have the view be transparent (see this SO question).

这个伟大的工程,只有一句话是,我没能当动画视图控制器是presented。有没有人得到这个工作?如果不是这样,我有什么其他选择?

This works great, only remark is that I'm not able to animate when the view controller is presented. Has anyone gotten this to work? If not, what other options do I have?

视图控制器我presenting是一个演练,它由一个的UIScrollView UIPageControl 是应该悬停在接口上,所以你可以看到它的背景微翘的边缘。

The view controller I'm presenting is a "walkthrough" that consists of a UIScrollView and UIPageControl that is supposed to "hover" over the interface so you can see the background of it slightly at the edges.

推荐答案

我落得这样做的:

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;

这篇关于presenting透明度和动画视图控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆