iPa*_*tel 12 cocoa-touch objective-c catransition ios
可能是这种类型的问题发生在很多开发者身上,我也试图在Google上找到但是没有运气来解决我的问题.
在我的rootViewController动态窗口设置中,我的意思是用户可以在运行时应用程序中更改根视图.所以,首先我删除当前rootViewController由UIWindow然后我设置新rootViewController的UIWindow特定动画.这个动画所做CATransition用transition.type = kCATransitionPush;.
我的应用程序工作得很好,除了新的动画rootViewController.正如上面我说我用kCATransitionPush用CATransition
编辑: 以下是我的代码:
-(void) changeRootViewController
{
for(UIView *subViews in self.window.rootViewController.view.subviews)
[subViews removeFromSuperview];
[self.window.rootViewController.view removeFromSuperview];
self.window.rootViewController.view = nil;
[self.window.rootViewController removeFromParentViewController];
MainRootViewController *mainRootVC = [[MainRootViewController alloc] init];
CATransition *animation = [CATransition animation];
[animation setDuration:0.4];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromRight];
animation.fillMode = kCAFillModeForwards;
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault]];
self.window.rootViewController = mainRootVC;
[[self.window layer] addAnimation:animation forKey:nil];
}
Run Code Online (Sandbox Code Playgroud)
我也尝试设置clearColor和whiteColor背景UIWindow.但不工作.
我的问题是:当动画是进程(从右到左)时,我会变黑.所以任何人都可以帮我隐藏这个黑影子?请给你金色的建议.
谢谢.
在委托中添加以下两行(didFinishLaunchingWithOptions 方法):
self.window.backgroundColor = [UIColor whiteColor];
self.window.tintColor = [UIColor whiteColor];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2745 次 |
| 最近记录: |