2017-06-15 88 views
0

在一个完整的UITableView的模糊效果,我有以下代码:创建斯威夫特

if !UIAccessibilityIsReduceTransparencyEnabled() 
    { 
     view.backgroundColor = UIColor(patternImage: UIImage(named: "sunset-photo.jpg")!); 

     let blurEffect = UIBlurEffect(style: UIBlurEffectStyle.light); 
     let blurEffectView = UIVisualEffectView(effect: blurEffect); 

     blurEffectView.frame = view.bounds; 
     blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight]; 

     view.addSubview(blurEffectView); 
    } 
    else 
    { 
     view.backgroundColor = UIColor(red: 110/255, green: 110/255, blue: 110/255, alpha: 1.0); 
    } 

    return view; 
} 

这是罚款regulat UIViews但表视图滚动。向下拖动然后创建黑色背景并向下滚动显示没有模糊效果的图像。我该如何解决?新的迅速顺便。

+0

将'blurEffectView.frame = view.bounds'更改为'blurEffectView.frame = view.frame' – WeiJay

+0

这并不正确。 – cdub

+0

还有其他想法吗?我无法让它工作。 – cdub

回答

0

将tableview背景颜色设置为。清除颜色

+0

你能指定更多吗?谢谢。 – cdub

+0

我认为他意味着你应该设置表视图的背景颜色来清除,并且在表视图后面有一个视图。然后,tableview后面的视图会使图像具有模糊效果,并且在tableview本身滚动时不会看到任何奇怪的问题。 – Msencenb