使用 UISheetPresentationController 时有什么方法可以改变调光量吗?

问题描述 投票:0回答:1

我最近一直在使用 UISheetPresentationController,想知道在使用 UISheetPresentationController 时是否可以更改调光量。查看文档,看起来我可以使用largestUndimmedDetentIdentifier删除调光,但我没有看到任何与使其变暗相关的内容。

ios uikit uisheetpresentationcontroller
1个回答
0
投票

目前最简单的方法是更改正在呈现的底部工作表中呈现视图控制器的

alpha
。像这样:

      override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        UIView.animate(withDuration: 0.4) {
          self.presentingViewController?.view.alpha = 0.6
        }
      }
      override func viewWillDisappear(_ animated: Bool) {
        super.viewWillDisappear(animated)
        UIView.animate(withDuration: 0.4) {
          self.presentingViewController?.view.alpha = 1
        }
      }

我希望苹果以后能让演示方面更容易做到这一点。

© www.soinside.com 2019 - 2024. All rights reserved.