- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我有一个可以正常工作的自定义动画,只是在关闭动画结束时出现黑屏。
转换的代码是:
class FolderAnimationController: NSObject, UIViewControllerAnimatedTransitioning {
let duration = 5.0
var presenting = true
var originFrame = CGRect.zero
var selectedFolderCell: FolderCollectionViewCell?
func transitionDuration(_ transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
return duration
}
func animateTransition(_ transitionContext: UIViewControllerContextTransitioning) {
let containerView = transitionContext.containerView()
let toViewC = transitionContext.viewController(forKey: UITransitionContextToViewControllerKey)!
let fromViewC = transitionContext.viewController(forKey: UITransitionContextFromViewControllerKey)!
let folderViewC = presenting ? fromViewC as! ViewController : transitionContext.viewController(forKey: UITransitionContextToViewControllerKey) as! ViewController
let projectViewC = presenting ? toViewC as! ProjectViewController : transitionContext.viewController(forKey: UITransitionContextFromViewControllerKey) as! ProjectViewController
let cellView = presenting ? (folderViewC.folderCollectionView.cellForItem(at: (folderViewC.folderCollectionView.indexPathsForSelectedItems()?.first!)!) as! FolderCollectionViewCell).folderView : projectViewC.containerView
let cellSnapshot: UIView = presenting ? cellView!.snapshotView(afterScreenUpdates: false)! : cellView!.snapshotView(afterScreenUpdates: false)!
let cellFrame = containerView.convert(cellView!.frame, from: cellView!.superview)
cellSnapshot.frame = cellFrame
cellView!.isHidden = true
toViewC.view.frame = transitionContext.finalFrame(for: toViewC)
toViewC.view.layoutIfNeeded()
toViewC.view.alpha = 0
presenting ? (projectViewC.containerView.isHidden = true) : (self.selectedFolderCell!.folderView.isHidden = true)
containerView.addSubview(toViewC.view)
containerView.addSubview(cellSnapshot)
UIView.animate(withDuration: duration, animations: {
toViewC.view.alpha = 1.0
let finalFrame = self.presenting ? projectViewC.containerView.frame : self.originFrame
cellSnapshot.frame = finalFrame
}) { (_) in
self.presenting ? (projectViewC.containerView.isHidden = false) : (self.selectedFolderCell?.isHidden = false)
cellSnapshot.removeFromSuperview()
transitionContext.completeTransition(true)
}
}
}
以及调用动画的第一个 View Controller 的代码:
func animationController(forPresentedController presented: UIViewController, presenting: UIViewController, sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
presentAnimator.presenting = true
presentAnimator.originFrame = openingFrame!
presentAnimator.selectedFolderCell = selectedCell!
return presentAnimator
}
func animationController(forDismissedController dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
presentAnimator.presenting = false
return presentAnimator
}
最佳答案
使用 UIViewPropertyAnimator.runningPropertyAnimator 代替 UIView.animate
关于iOS 10 - 自定义动画后黑屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38432269/
我正在学习微处理器类(class),但我的代码有问题。 我需要编写一个程序代码,让一个词四处移动。 代码在 (80*25) 屏幕上正常工作(因为我的计算依赖于它) 但问题是:当我最大化显示屏幕时,一切
尝试使用 exoplayer v2.10.5 播放 m3u8 时变黑,这让我添加了或者我如何使用 exoplayer v2.10.5 和 gradle 3.5.3 播放 m3u 或者哪个版本的 exo
有几个现有的例子,但我想要一个使用 complex_filter 来实现目标的命令,而不需要做额外的事情,比如生成空白视频/音频文件。 环顾四周,这是迄今为止我想出的最好的: ffmpeg -i vi
服务是“允许服务与桌面交互”。 unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls,
我有一个显示youtube的本地ios应用程序,直到昨天该应用程序运行良好,但是现在该应用程序显示了youtube,只有当我触摸“播放”而不是播放视频时,它才显示黑屏。 我的应用程序没有更改,因此我认
我正在尝试向我的游戏添加一些基本的 HUD,但是当我尝试更改视角时,我可以看到文本(我之前提到过 HUD),但是在黑屏上。问题出在哪里? gl.glMatrixMode(GL_PROJ
我的转换不起作用,第一个 ImageView 显示了可绘制对象,但在运行动画时它只是以白屏结束。不确定我错过了什么。 主要布局 第二个 Activity 布局 主要 Activity pu
出于某种原因,当我尝试运行此代码时,我得到的只是黑屏。我怎样才能真正让它显示我想要显示的内容? 我正在使用 Eclipse,并且已将 lwjgl.jar 和 lwjgl_utils.jar 添加到构建
我正在遵循有关构建“弹出锁类型”游戏的教程,当我在模拟器中运行它时,会出现黑屏。我之前查过并尝试重置模拟器并重新启动计算机,但它不起作用有人可以帮助我并告诉我为什么会发生这种情况 import Spr
我正在尝试 MrSnakey 游戏。当我运行它时,它没有给我任何错误。但是,模拟器在启动时显示黑屏。你们不知道如何解决吗?解决此问题所需的有关我的项目的任何信息,请告诉我,我会在此处发布。 首先是 l
所以我遇到了相机卡住的问题。当它第一次被调用时,它工作得很好。并在按钮上显示我的图像。但是,如果我回到同一个按钮再次调用相机,或者调用相机的页面上的任何其他按钮,它会启动相机但不是黑屏。相机实际上并没
我几乎阅读了关于这个主题的所有帖子,但似乎没有一个有帮助。 我正在 try catch 当前屏幕的屏幕截图。为此,我正在使用 getDrawingCache。这是我的代码: mRootView.get
我已经用我命名为 Label 的类实现了 CCLabelProtocol 和 CRGBAProtocol: #import @interface Label : CCNode @property
晚上好。我为 iOS 开发了几年,自从 iOS8 发布以来,我遇到了一个奇怪的问题。我确信它会被修复,但现在是 8.1.2,而且它还在发生。在 iOS7 上一切正常,但在运行 iOS8 的手机上发生了
这是我的完整代码。当我右击几次(动画正常工作)时,屏幕卡住。我认为来自 if(SDL_GetTicks() - start_time format, 0, 0xFF, 0xFF ) );
我需要执行以下操作: 用户登录。 重定向至欢迎屏幕。 在加载大量记录时查看欢迎屏幕。 重定向到工作屏幕。 我正在寻找一种在 Action 类中执行类似操作的方法: public class LinkA
我在 KMZ 文件中有一个坐标数据集,我希望能够为用户提供使用 GMSPanoramaView(使用 1.6.0 版本的 Google-Maps-iOS-SDK)查看街景的选项).这是我的代码的样子:
在尝试将应用内 HTML 页面加载到我们的 UIWebView 时,我在 iOS9 上遇到了奇怪的行为 - 有时页面加载,有时只是显示为空白屏幕。 webViewDidFinishLoad 函数也在这
我试图显示我的收藏 View ,但我得到的只是黑屏。我知道我在某处遗漏了一些东西,但我似乎找不到它是什么。 #import "StoreCollectionViewController.h" #imp
我正在尝试从我们的 iOS 应用程序中删除所有 Storyboard,因为在使用 Git 的团队中工作时它们会变得一团糟。 我现在在 AppDelegate 的 application(_:didFi
我是一名优秀的程序员,十分优秀!