我希望在我的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)
我希望你能为我工作,感谢你们的帮助。