- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 AccountsViewController,它的 UIVisualEffectView
在背景中具有模糊效果(索引 0 处的 subview ),因此它在过渡期间用模糊覆盖了之前的 Controller 。但是当我切换到另一个应用程序并再次打开多任务菜单以切换回我的应用程序时,其模糊的 UIVisualEffectView 似乎已损坏(如屏幕截图 1 所示)。当我再次激活我的应用程序时, View 得到“修复”并且再次看起来正常(如第二个屏幕截图所示)
我添加模糊 View 的自定义过渡类中的一些代码
// in the animateTransition.. method
guard let container = transitionContext.containerView() else {
return
}
let blurEffectView: UIVisualEffectView
if container.viewWithTag(101) != nil {
blurEffectView = container.viewWithTag(101)! as! UIVisualEffectView
}
else {
blurEffectView = UIVisualEffectView(frame: container.frame)
blurEffectView.translatesAutoresizingMaskIntoConstraints = false
blurEffectView.tag = 101
container.addSubview(blurEffectView)
}
if self.isPresenting {
// We're presenting a view controller over another
toViewController.view.transform = CGAffineTransformMakeScale(0.7, 0.7)
container.addSubview(toViewController.view)
container.sendSubviewToBack(blurEffectView)
toViewController.view.alpha = 0
UIView.animateWithDuration(self.transitionDuration(transitionContext), delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0.8, options: [], animations: { () -> Void in
fromViewController.view.transform = CGAffineTransformMakeScale(0.8, 0.8)
toViewController.view.transform = CGAffineTransformMakeScale(1, 1)
blurEffectView.effect = UIBlurEffect(style: .Dark)
toViewController.view.alpha = 1
}, completion: { (completed) -> Void in
self.context?.completeTransition(completed)
})
}
else {
// We're dismissing a view controller
UIView.animateWithDuration(self.transitionDuration(transitionContext), delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0.8, options: [], animations: { () -> Void in
fromViewController.view.transform = CGAffineTransformMakeScale(0.7, 0.7)
toViewController.view.transform = CGAffineTransformMakeScale(1, 1)
blurEffectView.effect = nil
fromViewController.view.alpha = 0
}, completion: { (completed) -> Void in
fromViewController.view.removeFromSuperview()
self.context?.completeTransition(completed)
})
}
最佳答案
似乎我自己已经弄明白了:这个问题只有在有一个 UIWindow 背面(黑色)显示出来时才会出现。在这个问题中,我有一个带有这些 View 的过渡动画容器:
由于 fromViewController 的 View 大小(由于比例变换,它比屏幕小),黑色的 UIWindow View 被显示出来。根据我的研究,这会导致 UIVisualEffectView 产生这个问题中描述的故障。
解决方案是添加一个带有 UIWindow 框架的黑色 UIView,并将其添加到容器 View 层次结构的底部:
let blackView = UIView(frame: container.frame)
blackView.backgroundColor = UIColor.blackColor()
container.insertSubview(blackView, atIndex: 0)
然后这个故障似乎不再出现了。
关于swift - 多任务处理中奇怪的 UIVisualEffectView 行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36120685/
我有一个 UIVisualEffectView,我试图在 viewdidload 时将其设置为 nil 我做错了什么? @IBOutlet var popUpView: UIView! @IBOutl
我使用 UIVisualEffectView 来模糊我的 ImageView 。然后我使用此代码将其转换为图像并保存到图像库。 UIGraphicsBeginImageContextWithOpti
我正在尝试使用 UIVisualEffectView 创建模态弹出窗口作为背景。我希望 UIVisualEffectView 位于标签栏上方,但我看不到实现它的方法。 这是我所做的,但这不是我想要的输
我有一个问题一直困扰着我。我在我的应用程序主视图之上有一个自定义 View 用于设置配置。这个 View 的背景使用了一个UIVisualEffectView。但是,我的应用同时支持纵向和横向模式,并
我正在尝试设置一个带有圆角但只有左上角和右上角以及带有彩色边框的 View 。这是我的观点类: class PullUpOverview: UIVisualEffectView { override
我正在使用 UIVisualEffectView 在 SpriteKit 中模糊屏幕的一部分,如下所示: let blur:UIBlurEffect = UIBlurEffect(style: UIB
我正在尝试使用以下代码为我的 View 添加模糊效果: let visualEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .L
我在扩展和收缩 UIEffectView 时遇到问题。它可以很好地扩展,但当它收缩时,它会立即弹到最终高度并滑入到位,在它的尾迹中留下微弱的振动效果。这是一个 gif 来说明这个问题。 http://
我正在制作一个自定义控制圈。圆圈的一部分可能是透明的。如果它是半透明的而不是透明的,它会更有视觉感并且看起来更好。 因为 View 是矩形的,我只希望圆是半透明的,而不是矩形的其余部分,这是一个问题。
我的应用使用 UIVisualEffectView 来模糊背景,就像控制中心一样。但我发现可以运行 iOS 8 的 iPad 2(和 Retina iPad)不够强大,无法显示这种效果,因此它会恢复为
我有一张 map 。在 map 上,我想画一个模糊的小圆圈。我已经实现了这样的事情: UIVisualEffect *visualEffect = [UIBlurEffect effectWithSt
在我的 ViewController.swift 中: var img = UIImageView(image: UIImage(named: "puddles")) img.frame = view
您好,我想知道是否可以在 UIVisualEffectView 上设置圆角半径?这是我试过的代码: @IBOutlet var blurView: UIVisualEffectView! var bl
我意识到我可以以编程方式添加 UIVisualEffects,如果类存在,则有条件地执行,例如。 if([UIVisualEffectView class]){ UIBlurEffec
我正在创建一个 UITableViewController(在 UINavigationController 的根部)并在另一个 View Controller 之上以模态方式呈现它。我让它在一定程度
我正在自定义 Parse 登录 View ,并使用库创建了模糊的背景,但现在我可以使用 UIVisualEffectView。因为我有一个类(class)作为 PFLoginViewControlle
如何减少 UIVisualEffectView 上的模糊效果,它为我提供了光、额外光和暗的选项,这对我来说还不够好,我正在尝试实现这样的目标 最佳答案 我们完全可以使用动画师以本地方式做到这一点,并具
我在 Storyboard场景中添加了一个透明的删除UIButton,该场景有一张图片作为背景,并且我为其添加了一些自动布局约束。 我希望按钮背景是 UIVisualEffectView 所以我正在考
我有一个 UIVisualEffectView,它在出现时会导致一些奇怪的人工制品。 UIVisualEffectView 在 View 加载后添加到代码中,因为它在 iOS 7 中不可用。 看看街景
我的 UICollectionView 有很多单元格。细胞上有需要模糊化的图像。这就是为什么我向 ImageView 添加具有模糊效果的UIVisualEffectView。单元格就像页面 - 每个单
我是一名优秀的程序员,十分优秀!