视图过渡动画
我有这样的代码:
- (void) displayView:(int)intNewView{
NSLog(@"%i", intNewView);
[currentView.view removeFromSuperview];
[currentView release];
switch (intNewView) {
case 1:
currentView = [[EnterView alloc] init];
break;
case 2:
currentView = [[MainMenuView alloc] init];
break;
case 3:
currentView = [[DetailsView alloc] init];
break;
case 4:
currentView = [[PhotosView alloc] init];
break;
case 5:
currentView = [[CustomUITableViewViewController alloc] init];
break;
}
[self.view addSubview:currentView.view];
}
这段代码成功地转换了视图,但是它并不像您想象的那么壮观(视图只是简单地切换而没有动画)。我想知道是否有一种简单的方法可以在这里添加任何类型的简单视图过渡动画?我不知道如何实现我在网上找到的任何示例。任何动画就足够了,只是一些让事情变得有趣的东西:)
谢谢,
杰克
I have this code:
- (void) displayView:(int)intNewView{
NSLog(@"%i", intNewView);
[currentView.view removeFromSuperview];
[currentView release];
switch (intNewView) {
case 1:
currentView = [[EnterView alloc] init];
break;
case 2:
currentView = [[MainMenuView alloc] init];
break;
case 3:
currentView = [[DetailsView alloc] init];
break;
case 4:
currentView = [[PhotosView alloc] init];
break;
case 5:
currentView = [[CustomUITableViewViewController alloc] init];
break;
}
[self.view addSubview:currentView.view];
}
This code successfully transitions views, however its not very spectacular as you can imagine (the view simply switches with no animation). I'm wondering if there is a simple way to add any kind of simple view transition animation here? I can't figure out how to implement any of the example I've found online. Any animation would suffice, just something to spice things up a bit :)
Thanks,
Jack
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以简单地使用基本的核心动画:
像这样:
您可以尝试不同的 UIViewAnimationTransitions,对于“forView”,您输入当前屏幕上的视图。希望有帮助。
You can simply use basic core animations:
Like this:
You can try different UIViewAnimationTransitions, for the "forView" you enter the view that currently is on the screen. Hope that helped.