不透明度仅在以模态方式呈现UIPageViewController时起作用。

huangapple go评论58阅读模式
英文:

Opacity only works for a moment when modally presenting a UIPageViewController

问题

我有一个模态跳转到UIPageViewController。

我想让UIPageViewController的背景变得透明。我已经在viewDidLoad()中设置了这个,并且已经为页面视图控制器设置了自定义视图控制器,其背景为深灰色,不透明度为0.98。

当跳转出现时,0.98的不透明度大约持续了一秒钟,然后变得不透明。

我尝试过全屏和当前上下文的呈现样式,还尝试过将自定义视图控制器的背景设置为.clear / 页面视图控制器中的不透明度0.98。

有什么想法吗?

英文:

I have a modal segue to a UIPageViewController.

I would like the background of the UIPageViewController to be clear. I have set this in the viewDidLoad(), and have set the custom view controller for the page view controller to have a dark grey background with 0.98 opacity.

When the segue pops up, the 0.98 opacity works for about a second and then goes opaque.

I've tried both full screen and current context presentation styles, and tried swapping so that it's background = .clear in the custom view controller / opacity 0.98 in the page view controller.

Any ideas?

答案1

得分: 0

  • 将segue呈现方式更改为自动
  • 在UIPageViewController的viewDidLoad()中,将view.backgroundColor设置为.clear
  • 在自定义视图控制器的viewDidLoad()中,设置backgroundColor为.clear和opacity
英文:
  • Changed segue presentation to automatic
  • view.backgroundColor = .clear in UIPageViewController viewDidLoad()
  • backgroundColor = .clear and opacity in the custom View Controller viewDidLoad()

huangapple
  • 本文由 发表于 2023年7月27日 18:32:05
  • 转载请务必保留本文链接:https://go.coder-hub.com/76778861.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定