Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I change DUXBetaFPVWidget.fpvView.backgroundColor #31

Open
fanbaoyuanbees360 opened this issue Jul 8, 2021 · 1 comment
Open

Comments

@fanbaoyuanbees360
Copy link

I want to change fpvWidget.fpvView.backgroundColor,
but the fpvView is fileprivate.

How can I change the fpvView.backgroundColor?

@alzin
Copy link

alzin commented May 8, 2022

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)

photo_2022-05-08 18 04 31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants