我正在使用FXBlurView但是当我将blurView设置为动画时,我在顶部会收到一条奇怪的黑线。
我有一个UITable
,它是ViewController的3/4,其余的是图像。发生的事情是它只是在超级视图中拾取UITable
而不是图像。那么有没有办法让superview
同时接收两者?还是替代?
我已经读过,可以通过将superview替换为实际的UIView
来解决这个问题FXBlurView通过以下方式捕获其即时超级视图的内容 默认。如果超级视图是透明的或部分透明的, 显示在其后面的内容将不会被捕获。你可以覆盖
underlyingView
属性捕获不同视图的内容 如果你需要。
FXBlurView.m
代码为:
- (UIView *)underlyingView
{
return _underlyingView ?: self.superview;
}
我试过这个:
((FXBlurView *)self.Genres).underlyingView = _main_view;
但这没什么区别
其中ImagesTableViewController
是我的主要ViewController
,其中包含Blured Uiview和我要复制的那个(main_view
)
但这只会为Blured Uiview创建一个白页。
答案 0 :(得分: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设置为抓取的图像并将其设置为基础视图。你不应该这样做:)
如果不这样做,我需要看一些代码来理解视图层次结构。