消除UINavigationBar和UIVisualEffectView之间的独特模糊边缘

Pan*_*yue 10 uinavigationbar ios swift uivisualeffectview ios9

目前,我的视图层次结构包括一个UIViewController(NOT UITableViewController),一个嵌套在视图控制器中的UITableView和一个位于UITableView前面的UIVisualEffectView(设置为Extra Light),与UINavigationBar的底部对齐.我想要实现的效果有点类似于App Store的分段视图.

但是,我注意到在导航栏和UIVisualEffectView之间的边界处出现了一个奇怪的模糊边缘,使视图看起来不一致,如下图所示(由红色圆圈突出显示):

在此输入图像描述

最理想的是,我更喜欢UIVisualEffectView与UINavigationBar的模糊完美融合.

谢谢.

Ale*_*ano 1

查看您的图片,您的问题似乎不是归因于UINavigationBar您添加的视图UISegmentedControl。我不知道你的结构,但它可能是tableHeaderView( self.tableView.tableHeaderView) 所以解决这个问题的合理方法是更改​​标题颜色:

代码示例

override func tableView(tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
        var headerView: UITableViewHeaderFooterView = view as! UITableViewHeaderFooterView
        header.contentView.backgroundColor = UIColor.clearColor()
        return header
}
Run Code Online (Sandbox Code Playgroud)