Mobile-UXSDK-Beta-iOS
Mobile-UXSDK-Beta-iOS copied to clipboard
How can I change DUXBetaFPVWidget.fpvView.backgroundColor
I want to change fpvWidget.fpvView.backgroundColor, but the fpvView is fileprivate.
How can I change the fpvView.backgroundColor?
I know my solution is already late for you but I am pretty sure it is helpful for others!
The way that you change the background color of the FPVWidget is as follows:
// Define FPV Widget instance
let fpvWidget = DUXBetaFPVWidget()
// Access its view
let fpvWidgetView = fpvWidget.view
// Adding its view to current ViewController views (Important Step)
view.addSubview(fpvWidgetView!)
// Access all subviews inside the fpvWidgetView
fpvWidgetView!.subviews.forEach { v in
if v.duxbeta_className() == "UIView" { // This is exactly the view that we are changing its color to green
v.backgroundColor = .green
}
print(v.duxbeta_className()) // See all other subviews types
//[UIView, UXSDKCore.DUXBetaFPVGridView, UXSDKCore.DUXBetaFPVCenterView, UIStackView] will be printed out!
}
// stretch the fpvWidget to the whole screen
fpvWidgetView!.translatesAutoresizingMaskIntoConstraints = true
fpvWidget.install(in: self)