【问题标题】:Howto make iPhone screens sliding out? (Animation)如何让 iPhone 屏幕滑出? (动画片)
【发布时间】:2010-10-25 17:38:03
【问题描述】:
在某些 iPhone/iPad 应用程序中,您可以看到屏幕滑入和滑出。
直线滑入/滑出是如何工作的?
我只能找到动画的 Curl 和 Flip:
UIViewAnimationTransitionFlipFromLeft,
UIViewAnimationTransitionFlipFromRight,
UIViewAnimationTransitionCurlUp,
UIViewAnimationTransitionCurlDown,
【问题讨论】:
标签:
iphone
cocoa-touch
core-animation
【解决方案1】:
不确定您所说的滑入和滑出是什么意思,也许提供一个示例应用程序
我认为您的意思是将视图向左推以显示其下的下一个视图或类似的东西
-(void) slideView:(UIView *)uiv_slide toReveal:(UIView *)uiv_reveal withDuration:(double)d_duration {
//Add the subview to the ViewController's view
[self.view addSubview:uiv_reveal];
//Bring the view to slide to the front
[self.view bringSubviewToFront:uiv_slide];
//Make an animation to slide the view off the screen
[UIView animateWithDuration:d_duration
animations:^ {
uiv_slide.center = CGPointMake(-1*(uiv_slide.frame.size.width/2), uiv_slide.frame.size.height/2);
}
];
}
希望代码有所帮助
【解决方案2】:
如果您基于导航应用模板制作应用,则从视图到视图的转换将具有滑入/滑出动画。
【解决方案3】:
看看一些自定义动画here. 这将允许您根据需要为视图设置动画。您还可以使用苹果导航控制器为您的应用程序构建向下钻取结构。这些视图会自动滑动过渡。