简体   繁体   English

动态化视图控制器从一个到另一个的过渡,而无需导航控制器堆栈

[英]Animate transition of view controllers from one to another without navigation controller stack

How i can Animate transition of view controllers from one to another without navigation controller stack. 我如何在没有导航控制器堆栈的情况下动画化视图控制器从一个到另一个的过渡。 View Controller is managed only by UIToolbar because it has only play, rewind, stop, info and option buttons. View Controller仅由UIToolbar管理,因为它仅具有播放,快退,停止,信息和选项按钮。 My code is given below right now i have is 23 view controllers which are loading one after the other but during transition UIToolbar is also flipping along with the view controllers which is wrong. 我的代码在下面给出,我现在有23个视图控制器,它们一个接一个地加载,但是在过渡期间,UIToolbar也会与视图控制器一起翻转,这是错误的。

-(void)playAction:(id)sender
{
[audioPlayer play];
[self performSelector:@selector(displayviewsAction:) withObject:nil afterDelay:11.0];
}

- (void)displayviewsAction:(id)sender
{ 
First *firstController = [[First alloc] init];
firstController.view.frame = CGRectMake(0, 0, 320, 480);
CATransition *transitionAnimation = [CATransition animation]; 
[transitionAnimation setDuration:1];  
[transitionAnimation setType:kCATransitionFade];   
[transitionAnimation setTimingFunction:[CAMediaTimingFunction     functionWithName:kCAMediaTimingFunctionEaseIn]];  
[self.view.layer addAnimation:transitionAnimation forKey:kCATransitionFade];
[self.view addSubview:firstController.view];
[self.view addSubview:toolbar];
[firstController release];  
self.timer = [NSTimer scheduledTimerWithTimeInterval:23 target:self selector:@selector(Second) userInfo:nil repeats:NO];    
}

-(void)Second
{
Second *secondController = [[Second alloc] init];
secondController.view.frame = CGRectMake(0, 0, 320, 480);
CATransition *transitionAnimation = [CATransition animation];
[transitionAnimation setDuration:1];
[transitionAnimation setType:kCATransitionFade];
[transitionAnimation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
[self.view.layer addAnimation:transitionAnimation forKey:kCATransitionFade];
[self.view addSubview:secondController.view];
[self.view addSubview:toolbar];
[secondController release];
self.timer = [NSTimer scheduledTimerWithTimeInterval:27 target:self selector:@selector(Third) userInfo:nil repeats:NO];
}

-(void)Third {
Third *thirdController = [[Third alloc] init];
thirdController.view.frame = CGRectMake(0, 0, 320, 480);
CATransition *transitionAnimation = [CATransition animation];
[transitionAnimation setDuration:1];
[transitionAnimation setType:kCATransitionFade];
[transitionAnimation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
[self.view.layer addAnimation:transitionAnimation forKey:kCATransitionFade];   
[self.view addSubview:thirdController.view];
[self.view addSubview:toolbar];
[thirdController release];
self.timer = [NSTimer scheduledTimerWithTimeInterval:23 target:self selector:@selector(Fourth) userInfo:nil repeats:NO];
}

-(void)Fourth {
Fourth *fourthController = [[Fourth alloc] init];
fourthController.view.frame = CGRectMake(0, 0, 320, 480);
CATransition *transitionAnimation = [CATransition animation];
[transitionAnimation setDuration:1];
[transitionAnimation setType:kCATransitionReveal];
[transitionAnimation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
[self.view.layer addAnimation:transitionAnimation forKey:kCATransitionReveal];
[self.view addSubview:fourthController.view];
[self.view addSubview:toolbar];
[fourthController release];
self.timer = [NSTimer scheduledTimerWithTimeInterval:25 target:self selector:@selector(Fifth) userInfo:nil repeats:NO];
}

I am still looking for solution. 我仍在寻找解决方案。 Will appreciate help. 将不胜感激。

just push them all 推动他们

NSMutableArray *controllers = [NSMutableArray arrayWithArray:[self.navigationController viewControllers]];
[controllers addObject:vc1];
[controllers addObject:vc2];
[controllers addObject:vc3];
[controllers addObject:vc4];
[self.navigationController setViewControllers:controllers animated:YES];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在不使用导航控制器堆栈,子视图或模态控制器的情况下更改视图控制器的动画? - Animate change of view controllers without using navigation controller stack, subviews or modal controllers? 从一个导航控制器切换到另一个导航视图控制器 - switch from one navigation Controller to another navigation View Controller 在没有导航控制器的情 - Switching view controllers without navigation controller iPhone导航控制器-纵向和横向视图控制器之间的过渡 - iphone navigation controller - transition between portrait and landscape view controllers 没有导航控制器的iOS视图之间的过渡 - transition between view in iOS without navigation controller 查看过渡而不使用导航 controller? - View transition without using navigation controller? 问题将多个视图控制器推送到导航控制器堆栈 - Problem pushing multiple view controllers onto navigation controller stack 在没有导航控制器的情况下导航到另一个视图控制器 - Navigating to another view controller without a navigation controller 使用堆栈的导航控制器/视图控制器 - Navigation Controllers/View Controllers working with a stack 如何使用多个iOS自定义视图控制器而不使用导航控制器 - How to use multiple iOS custom view controllers without a navigation controller
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM