1

我正在使用FXBlurView,但在为 blurView 设置动画时,我在顶部收到一条奇怪的黑线。

我有一个UITable是 ViewController 的 3/4 和一个图像是其余的。正在发生的事情是它只在超级视图中拾取UITable而不是图像。那么有没有办法让superview两者都捡起来?或替代品?

在此处输入图像描述

我已经读过这可以通过用实际的 UIView 替换 superview 来解决

FXBlurView 默认捕获其直接父视图的内容。如果 superview 是透明的或部分透明的,它后面显示的内容将不会被捕获。如果需要,您可以覆盖该 underlyingView属性以捕获不同视图的内容。

FXBlurView.m代码是:

- (UIView *)underlyingView
{
    return _underlyingView ?: self.superview;
}

我试过这个:

((FXBlurView *)self.Genres).underlyingView = _main_view;

但这没有什么区别

ImagesTableViewController我的 mainViewController包含 Blured Uiview 和我要复制的那个在哪里(main_view

但这只是为 Blured Uiview 创建了一个白页。

4

1 回答 1

1

首先,您根本不需要编辑 FXBlurView 源。

其次,我猜黑条是没有被拾取的视图层次结构的一部分。也许是导航栏?您可以尝试将模糊视图添加到窗口而不是视图,以便获取所有内容:

[[[UIApplication sharedApplication] keyWindow] addSubview: blurView];

失败了,我能想到的唯一黑客是制作一个使用窗口抓取其图像的 imageView,例如:

- (UIImage *)screenGrab:(id) theView {

   CGRect rect = [self.view bounds];

    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    [theView.layer renderInContext:context];   
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return image;
}

和:

[self screenGrab: [[UIApplication sharedApplication] keyWindow]];

然后将 imageView.image 设置为抓取的图像并将其设置为底层视图。不过,您不需要这样做:)

失败了,我需要查看更多代码来理解视图层次结构。

于 2014-07-05T10:57:41.603 回答