问题标签 [custom-transition]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
440 浏览

ios - 自定义 ViewController Transitions:获取 ToViewController 的 Subview 的 Frame

这是我的问题的说明:

插图

我在 ViewControllers A 和 B 中有StarImageView,它显示相同的图像,但在其 ViewController 中具有彼此不同的帧。

当点击 ViewController A 中的StarImageView时,应用程序会将一个新的视图控制器推送到导航控制器堆栈中,同时动画到其在 ViewController B 中的最后一帧。

这种行为就像 iPhone 照片应用程序中的过渡一样。


我现在怎么做

我使用 ViewController A 中的初始StarImageView 的帧和图像初始化动画对象中的临时 UIImageView,并通过硬编码矩形CGRectMake(0, 60+44, containerView.bounds.size.width, containerView.bounds.size.width)(ViewController B 中的StarImageView的帧)将其动画到最终帧,并从超级视图中删除临时 UIImageView动画完成块。


我希望怎么做

该项目是在启用自动布局的故事板中创建的。我想做的是在过渡期间在 ViewController B 中获取StarImageView的框架,而不是像上面那样对其进行硬编码。由于 ViewContorller 生命周期,我无法在动画对象的 ViewController B 中引用任何子视图,因为它们尚未初始化。

对于这种情况,还有其他解决方案或最佳实践吗?提前致谢!

PS我已经看到了这个这个这个,但没有运气的答案。

0 投票
1 回答
315 浏览

ios - 如何使用 CGAfflineTransformIdentity 发生视图控制器转换

我一直在尝试在呈现另一个视图控制器时进行自定义转换,并且我以两种方式成功。一种是通过使用 CGAfflineTransformIdentity,另一种是通过使用 CGAffineTransformMakeTranslation 推送 ViewController。

Apple 文档将 CGAfflineTransformIdentity 描述为单位单位矩阵。当我用单位矩阵转换视图时,我的动画是如何发生的?

在实际数学中,当我将一些东西与单位矩阵相乘时,我得到了相同的矩阵。

那么 CGAfflineTransformIdentity 是如何真正实现转换的呢?

0 投票
1 回答
103 浏览

android - Implementing Teleport transition in Android

This question refers to the Transitions API. I am using TransitionManager.beginDelayedTransition. As I have several views changing position, I wanted to teleport some of them, because moving them doesn't look good. By teleporting I mean, making them disappear animatedly, and then reappear in the new position, also animatedly. I have overriden Visibility to modify how views appear or disappear, but I don't know how to override ChangeBounds (or any other class, if more appropriate) to make the view disappear and reappear instead of move.

This code is an attempt I have done, but it does nothing to the view.

Returning appear, or disappear has the same result: nothing.

0 投票
2 回答
1222 浏览

ios - 为什么应用自定义推送动画时键盘隐藏?

我有两个带有 UITextFields 的控制器。我需要在它们之间使用显示的键盘进行自定义转换,以及转换。

当我使用默认的推送动画时,一切都很好。但是,如果我从 中返回我的转换类animationControllerForOperation,则键盘在转换之前隐藏并在转换之后显示。

那么,有人可以向我建议一个解决方案或解释,为什么键盘隐藏在自定义转换中?过渡持续时间 = 0.4,我设置[textField becomeFirstResponder]viewDidLoad.

这是一个视频:https ://www.youtube.com/watch?v=gs16tMsU4qY

0 投票
1 回答
119 浏览

objective-c - 如何在 animateTransition:transitionContext 中访问 UITableView 单元格框架

我正在尝试进行模态自定义转换,其中我需要在要转换的视图控制器中的 tableview 的第一个单元格框架。animateTransition:transitionContext当我在以下代码之后放置断点时:

我看到 tableview 以及页面上的所有其他控件都为零。

经过大量搜索后,我找到了一个类似的问题,该问题建议在推送 vc 时使用以下代码:

但这不起作用,tableview 和所有其他页面元素都为零animateTransition:transitionContext

我知道我得到 nil 是因为在视图生命周期的这一点上,尚未计算 tableview,但是没有某种方法可以在自定义转换中引用 tableview 单元格吗?

0 投票
3 回答
1778 浏览

ios - 自定义过渡 iOS(Push/Pop)

我在推送一个新的 viewController时创建了一个自定义放大过渡,它过去工作得非常好。现在我想在弹出viewController时创建一个缩小效果 ,即使认为最终状态是正确的,动画也是错误的,因为我不知道如何识别它是推动还是弹出以及所有方法,如isBeingPresentedreturn false 并且presentedViewController总是 nil

0 投票
1 回答
3068 浏览

ios - UINavigationControllerDelegate 方法,在 ios 8 中使用导航控制器进行自定义转换

我正在尝试在弹出或推送我的导航控制器时创建自定义转换。我创建了一个符合 UINavigationControllerDelegate 的 transitionManager 类。我已经创建了这个transitionManager 的对象并将它作为一个transitioningDelegate 添加到我的navigationController 中。

推送动画运行良好,但是当我尝试弹回之前的 viewController 时,我只看到黑屏。

我浏览了许多其他帖子以使其正常工作并尝试了手头的所有内容,但是当我弹出时它仍然没有显示以前的 ViewController。

transitionManager 的代码在这里:

0 投票
1 回答
2401 浏览

ios - 不使用 Storyboard segues 的自定义视图转换 (Swift)

我有两个视图我想做一个滑动样式转换,当有一个 segue 可以操作但我没有一个所以我不知道如何应用我的动画类时我已经这样做了。我在课堂上只有:

我想应用以下自定义 segue:

我不能让它工作任何指针吗?

0 投票
1 回答
452 浏览

ios - ios swift自定义过渡到从ViewController变暗

我想向我的视图控制器展示一个自定义转换,这样它fromViewController就会变暗,就像展示一个 AlertViewController 一样。我创建了我的 customTransition 管理器:

我将我的过渡经理分配给toViewController如下所示:

我将要显示的视图控制器在故事板中,大小固定。它有一个清晰的背景,我在那里添加了一个表格视图,我希望它位于屏幕的中心。

TableView 显示没有问题,但我根本看不到 fromViewController。它只是黑色,即使我将黑色背景的 alpha 设置为 0,后来动画为 0.5。

我以模态方式展示视图控制器,这是导致问题的原因吗?我应该使用推送和弹出操作吗?

0 投票
1 回答
3712 浏览

ios - Custom transition for push animation with NavigationController on iOS 9

I have a custom push transition between view controllers embedded in a UINavigationController which is working fine when built with iOS 7/8 but presents a wrong layout when built against iOS 9 SDK.

It then goes on and performs an animation. The issue is that the content of the toViewController, even though it is using the right top layout guide auto layout constraint, presents the content behind the navigation bar.

Nevertheless, it works fine on iOS 8 and if we force a redraw (e.g., sending the app to the background and bring it back, present a modal on top and dismiss it, etc) will cause the whole auto layout system to redraw itself and toViewController's view jumps to the right place (as being the top layout guide, x pixels from the navigation bar rather than x pixels from the top of the device's screen).

Adding

Works if put in viewDidAppear:animated, but does not work on viewDidLoad or viewWillAppear:animated. This is not a solution as users would see the view jumping when the redraw is happening at viewDidAppear:animated