gpt4 book ai didi

ios - clearColor 使背景色变黑

转载 作者:搜寻专家 更新时间:2023-10-31 08:25:32 24 4
gpt4 key购买 nike

我想在我的 UIViewController 中有一个透明的背景,因为我像这样使用了 clearColor

colorPickerVc.view.backgroundColor = UIColor.clearColor()
presentViewController(colorPickerVc, animated: true, completion: nil)

问题是当colorPickerVc加载完成后,背景颜色变成黑色如果可能,我想要一个适用于 ios 7 的解决方案谢谢你的帮助


@good4pc 的解决方案:

colorPickerVc.view.backgroundColor = UIColor.clearColor()
if #available(iOS 8.0, *)
{
colorPickerVc.modalPresentationStyle = UIModal PresentationStyle.OverCurrentContext
}
else
{
colorPickerVc.modalPresentationStyle = UIModalPresentationStyle.CurrentContext
}

presentViewController(colorPickerVc, animated: true, completion: nil)

为我工作,谢谢你们的帮助

最佳答案

colorPickerVc.modalPresentationStyle = UIModalPresentationStyle.OverCurrentContext
colorPickerVc.view.backgroundColor = UIColor.clearColor()

关于ios - clearColor 使背景色变黑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38504118/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com