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

我有一个UITable,它是ViewController的3/4,其余是图像。发生的是,它仅在 super 视图中拾取UITable而不是图像。那么有没有办法让superview来选择两者呢?还是替代品?

我已经读到可以通过将Superview替换为实际的UIView来解决此问题

FXBlurView通过以下方式捕获其直接监视的内容
默认。如果 super 视图是透明的或部分透明的,
它后面显示的内容将不会被捕获。您可以覆盖
underlyingView属性可捕获其他视图的内容
如果你需要。
FXBlurView.m代码为:

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

我已经试过了:
((FXBlurView *)self.Genres).underlyingView = _main_view;

但这没什么区别

其中ImagesTableViewController是我的主要ViewController,包含Blured Uiview和我要复制的Uiview(main_view)

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

最佳答案

首先,您根本不需要编辑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设置为抓取的图像,并将其设置为基础视图。不过,您不必这样做:)

失败的话,我需要看更多代码才能理解视图层次结构。

10-08 05:33