Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/97.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 显示具有透明度和动画的视图控制器_Ios_Cocoa Touch_Animation_Uiviewcontroller_Transparency - Fatal编程技术网

Ios 显示具有透明度和动画的视图控制器

Ios 显示具有透明度和动画的视图控制器,ios,cocoa-touch,animation,uiviewcontroller,transparency,Ios,Cocoa Touch,Animation,Uiviewcontroller,Transparency,我正在设置self.window.rootViewController.modalPresentationStyle=UIModalPresentationCurrentContext在我的应用程序委托中,这样我就可以呈现一个视图控制器,并且视图是透明的(请参见此) 这非常有效,唯一值得注意的是,当显示视图控制器时,我无法设置动画。有人用过这个吗?如果没有,我还有什么其他选择 我介绍的视图控制器是一个“演练”,它由一个uicrollview和UIPageControl组成,该控件应该“悬停”在界

我正在设置self.window.rootViewController.modalPresentationStyle=UIModalPresentationCurrentContext在我的应用程序委托中,这样我就可以呈现一个视图控制器,并且视图是透明的(请参见此)

这非常有效,唯一值得注意的是,当显示视图控制器时,我无法设置动画。有人用过这个吗?如果没有,我还有什么其他选择


我介绍的视图控制器是一个“演练”,它由一个
uicrollview
UIPageControl
组成,该控件应该“悬停”在界面上,以便您可以在边缘看到它的背景。

您可以使用基本视图控制器中存在的包含视图。不显示模态,而是将包容视图的位置设置为动画,以模拟模态显示

例如

TransparentViewController *viewController = [[TransparentViewController alloc] init];
viewController.view.frame = CGRectMake(0, 480, 320, 480);
self.containmnetView = viewController.view;
要做到这一点:

[UIView animateWithDuration:0.5f animations:^{
    self.containmentView.frame = CGRectMake(0, 0, 320, 480);
}];
我希望这能有所帮助。

我最后做了以下几点:

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;

当我从AppDelegate(例如Twitter身份验证回调)回调并显示透明视图控制器时,这对我也很有用。