Saturday, April 4, 2026
HomeiOS Developmentswift - I can not set the BackgroundColor of a StackView in...

swift – I can not set the BackgroundColor of a StackView in iOS 12 or older

[ad_1]

I am attempting to set a backgroundColor of a StackView and it really works on iOS 13 or newer, however on iOS 12 it is a full failure. Perhaps it is associated to darkMode though I do not use any associated settings.

I attempted to set the colour in VidDidLoad() and it did not work both, I am sort of misplaced, I appeared for different comparable questions, none had been the identical

ViewCode

remaining class PaymentCashViewCode: UIView, ViewCodeProtocol {
var salesValueComponent: UIStackView = {
    let view = UIStackView()
    view.backgroundColor = UIColor(named: .greyRhino)
    view.isLayoutMarginsRelativeArrangement = true
    view.axis = .vertical
    return view
}() 
}

ViewController

class PaymentCashViewController: UIViewController {
var mainView = PaymentCashViewCode()

func setupComponents() {
    self.view.addAttrachedSubView(view: mainView)
    self.title = viewModel.getViewControllerTitle()
    mainView.delegate = self
    mainView.setTextFieldDelegate(delegate: self)
    mainView.setTextFieldFocus()
}
}

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments