- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个 UIVisualEffectView,它在出现时会导致一些奇怪的人工制品。 UIVisualEffectView 在 View 加载后添加到代码中,因为它在 iOS 7 中不可用。
看看街景图像上模糊的文字背景:http://s.swic.name/Z3UL
模糊需要 0.1 秒才能出现,在此之前它只是一个较低分辨率的背景,就像尚未计算模糊一样。
知道发生了什么事吗?我正在使用这段代码在 awakeFromNib 中添加模糊
- (void)addBlurWithColor:(UIColor *)color andStyle:(UIBlurEffectStyle)style andVibrancy:(BOOL)vibrancy
{
if (UIDevice.supportsVisualEffects && NSClassFromString(@"UIVisualEffectView") && !UIAccessibilityIsReduceTransparencyEnabled()) {
self.backgroundColor = color;
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:style];
UIVisualEffectView *visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
visualEffectView.frame = self.bounds;
visualEffectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
NSArray *subviews = self.subviews;
[self addSubview:visualEffectView];
[self sendSubviewToBack:visualEffectView];
if (vibrancy) {
UIVibrancyEffect *vibrancyEffect = [UIVibrancyEffect effectForBlurEffect:blurEffect];
UIVisualEffectView *vibrancyEffectView = [[UIVisualEffectView alloc] initWithEffect:vibrancyEffect];
[vibrancyEffectView setFrame:self.bounds];
vibrancyEffectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
for (UIView *subview in subviews) {
[vibrancyEffectView.contentView addSubview:subview];
}
[[visualEffectView contentView] addSubview:vibrancyEffectView];
}
}
}
编辑:视频只是启用了慢速动画,过渡是常规的推送转场。
Edit2:如果我只是在 Interface Builder 中拖放一个“带有模糊的 UIVisualEffectView”,我会得到同样的奇怪行为,所以上面的代码不应该受到指责。
最佳答案
发现问题,当 View 出现时,我正在 [UIView transitionWithView:...]
中重新加载 tableview,这改变了 alpha,这显然是一个很大的禁忌,当涉及到 UIVisualEffectViews
!
根据 UIVisualEffectView 文档;
When using the UIVisualEffectView class, avoid alpha values that are less than 1. Creating views that are partially transparent causes the system to combine the view and all the associated subviews during an offscreen render pass. UIVisualEffectView objects need to be combined as part of the content they are layered on top of in order to look correct. Setting the alpha to less than 1 on the visual effect view or any of its superviews causes many effects to look incorrect or not show up at all.
https://developer.apple.com/library/ios/documentation/uikit/reference/UIVisualEffectView/index.html
关于ios - 带有 UIVisualEffectView 的奇怪模糊伪像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27606107/
我有一个 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。单元格就像页面 - 每个单
我是一名优秀的程序员,十分优秀!