简体   繁体   English

iOS“从左/右滑入”视图动画

[英]iOS “slide in from left/right” view animations

My iOS6 app has a multi-level table view whose leaf nodes open up separate views. 我的iOS6应用程序有一个多级表视图,其叶节点打开单独的视图。 The animation from the first level of the table slides the old view out to the left and the new view in from the right. 表格第一级的动画将旧视图向左滑动,向右滑动新视图。 I'd like to also use this slide-in animation when transitioning from a table view to a non-table view. 在从表视图转换到非表视图时,我还想使用此滑入式动画。 How? 怎么样?

Here's more info: 这里有更多信息:

On the first level of the table view, there are disclosure Indicators 在表格视图的第一级,有披露指标 在此输入图像描述 . When one is clicked, the first level of the table slides off to the left and the second level view slides in from the right. 单击一个时,表格的第一级向左滑动,第二级视图从右侧滑入。 Good. 好。

On the second level of the table, there are Detail Disclosure Buttons 在表的第二级,有详细信息披露按钮 在此输入图像描述 which take the user to a detail view for that element in the table. 它将用户带到表中该元素的详细视图。

I'd like to offer the same animation here too: the table view should slide off to the left and the new view should slide in from the right. 我也想在这里提供相同的动画:表格视图应向左滑动,新视图应从右侧滑入。

First, am I correct that this is the correct animation to use in this case? 首先,我是否正确,这是在这种情况下使用的正确动画?

Second, do you know why this "slide in" animation isn't in the standard view animations in UIViewAnimationTransition below? 其次,你知道为什么这个“幻灯片”动画不在UIViewAnimationTransition下面的标准视图动画中吗?

typedef enum {
   UIViewAnimationTransitionNone,
   UIViewAnimationTransitionFlipFromLeft,
   UIViewAnimationTransitionFlipFromRight,
   UIViewAnimationTransitionCurlUp,
   UIViewAnimationTransitionCurlDown,
} UIViewAnimationTransition;

Finally, if I do want to use the same slide in animation that table views use, but it's not available as one of the standard views, how should I add this animation when transitioning between a table view and a non-table view? 最后,如果我想在表视图使用的动画中使用相同的幻灯片,但它不能作为标准视图之一使用,那么在表视图和非表视图之间转换时应该如何添加此动画?

Typically this type of animation is done in a UINavigationController , and is the result of pushing a new viewController onto the stack. 通常,这种类型的动画在UINavigationController完成,并且是将新的viewController推送到堆栈的结果。 If you want to simulate it, all you need to do is add the newly exposed view to your current base view, to the right of the current view (ie off-screen) and use UIView 's animateWithDuration:animations:completion: method to move both the on-screen and off-screen views one screen to the left. 如果你想模拟它,你需要做的就是将新曝光的视图添加到当前视图的右边,即当前视图的右边(即屏幕外)并使用UIViewanimateWithDuration:animations:completion:方法到将屏幕和屏幕外的视图移动到左侧的一个屏幕。 (Use the completion: block to remove the original view or leave it in place so you can easily animate it back on-screen.) (使用completion:块删除原始视图或将其保留在原位,以便您可以轻松地将其设置为屏幕上的动画。)

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM