首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在手动分段时显示BlurEffect

问在手动分段时显示BlurEffect
EN

Stack Overflow用户
提问于 2017-09-18 17:18:25
回答 2查看 54关注 0票数 0

我有一个关于视图控制器上的blureffects的问题。出于几个原因,我手动编写了我所有的segues。但是当我打开一个背景模糊的视图控制器时,我只看到一个深灰色的背景。如何解决视图控制器模糊效果覆盖在另一个视图控制器上的问题,在这个视图控制器上可以看到前一个视图控制器的内容?

模糊效果现在由具有透明背景视图的故事板应用。

我的seque代码是:

操作:

代码语言:javascript
复制
@IBAction func ToUserSections(_ sender: Any) {
        let controller = 
        Navigation.getDestinationViewControllerWith("User", 
        controllerName: "UserSectionsVC")
        present(controller, animated: false, completion: nil)
    }

类:

代码语言:javascript
复制
class Navigation{
    static func getDestinationViewControllerWith(_ 
    storyboardName:String, controllerName:String)-> UIViewController{

    let storyboard = UIStoryboard(name: storyboardName, bundle: nil)
    let controller = 
    storyboard.instantiateViewController(withIdentifier: 
    controllerName) as UIViewController

    return controller
}

}

希望你能帮助我,因为它将最大限度地美观的应用程序:D

EN

回答 2

Stack Overflow用户

发布于 2017-09-18 17:52:48

尝尝这个。

代码语言:javascript
复制
 let viewController : CustomViewControlller = UIStoryboard.getMainStoryboard().instantiateViewController(withIdentifier: "Identifier") as! CustomViewControlller        
  viewController.modalPresentationStyle = .overCurrentContext
  viewController.modalTransitionStyle = .crossDissolve
  self.present(viewController, animated: true, completion: { _ in })
票数 0
EN

Stack Overflow用户

发布于 2017-09-18 23:33:06

好的,让其他人知道,对我起作用的是:

在IBAction:在演示之前添加以下代码行

代码语言:javascript
复制
controller.modalPresentationStyle = UIModalPresentationStyle.overFullScreen

如下所示:

代码语言:javascript
复制
@IBAction func ToUserSections(_ sender: Any) {
    let controller = Navigation.getDestinationViewControllerWith("User", controllerName: "UserSectionsVC")
    controller.modalPresentationStyle = UIModalPresentationStyle.overFullScreen
    present(controller, animated: false, completion: nil)
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46275720

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档