I ended up resolving my breaking constraints issue with my disappearing buttons which was I did not programmatically put them in a vertical stack view. I still get the failed to open load_eleigibility_plist message in my debugger.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
class CSGView: UIView {
var line0: UIBezierPath?
var line1: UIBezierPath?
var circleLayerLeft: CAShapeLayer?
var circleLayerRight: CAShapeLayer?
override func draw(_ rect: CGRect) {
line0?.stroke()
line1?.stroke()
}
}
private func addConstraints() {
let CSChoicesYpos = Int.random(in: 1...3)
if CSChoicesYpos == 1 {
CSGCardChoicesY1 = 100
CSGCardChoicesY2 = 200
CSGCardChoicesY3 = 300
}
if CSChoicesYpos == 2 {
CSGCardChoicesY1 = 200
CSGCardChoicesY2 = 300
CSGCardChoicesY3 = 100
}
if CSChoicesYpos == 3 {
CSGCardChoicesY1 = 300
CSGCardChoicesY2 = 100
CSGCardChoicesY3 = 200
}
let CSgraphicuserinterface = CSGView()
let CSChoiceACard = CSGView()
let CSChoiceBCard = CSGView()
let CSChoiceCCard = CSGView()
CSgraphicuserinterface.translatesAutoresizingMaskIntoConstraints = false
CSgraphicuserinterface.addSubview(CSChoiceACard)
CSgraphicuserinterface.addSubview(CSChoiceBCard)
CSgraphicuserinterface.addSubview(CSChoiceCCard)
CSgraphicuserinterface.addSubview(CSCorrectButton)
CSgraphicuserinterface.addSubview(CSInCorrectButton1)
CSgraphicuserinterface.addSubview(CSInCorrectButton2)
constraints.append(CSgraphicuserinterface.widthAnchor.constraint(equalTo: view.safeAreaLayoutGuide.widthAnchor))
constraints.append(CSgraphicuserinterface.heightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.heightAnchor))
constraints.append(CSgraphicuserinterface.centerXAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor))
constraints.append(CSgraphicuserinterface.centerYAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerYAnchor))
constraints.append(CSChoiceACard.widthAnchor.constraint(equalToConstant: 180))
constraints.append(CSChoiceACard.heightAnchor.constraint(equalToConstant: 79))
constraints.append(CSChoiceACard.centerXAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor, constant: CGFloat(CSGCardChoicesX)))
constraints.append(CSChoiceACard.centerYAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerYAnchor, constant: CGFloat(CSGCardChoicesY1)))
constraints.append(CSChoiceBCard.widthAnchor.constraint(equalToConstant: 180))
constraints.append(CSChoiceBCard.heightAnchor.constraint(equalToConstant: 79))
constraints.append(CSChoiceBCard.centerXAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor, constant: CGFloat(CSGCardChoicesX)))
constraints.append(CSChoiceBCard.centerYAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerYAnchor, constant: CGFloat(CSGCardChoicesY2)))
constraints.append(CSChoiceCCard.widthAnchor.constraint(equalToConstant: 180))
constraints.append(CSChoiceCCard.heightAnchor.constraint(equalToConstant: 79))
constraints.append(CSChoiceCCard.centerXAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor, constant: CGFloat(CSGCardChoicesX)))
constraints.append(CSChoiceCCard.centerYAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerYAnchor, constant: CGFloat(CSGCardChoicesY3)))
constraints.append(CSCorrectButton.widthAnchor.constraint(equalToConstant: 184))
constraints.append(CSCorrectButton.heightAnchor.constraint(equalToConstant: 83))
constraints.append(CSCorrectButton.centerXAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor, constant: CGFloat(CSGCardChoicesX)))
constraints.append(CSCorrectButton.centerYAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerYAnchor, constant: CGFloat(CSGCardChoicesY1)))
constraints.append(CSInCorrectButton1.widthAnchor.constraint(equalToConstant: 184))
constraints.append(CSInCorrectButton1.heightAnchor.constraint(equalToConstant: 83))
constraints.append(CSInCorrectButton1.centerXAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor, constant: CGFloat(CSGCardChoicesX)))
constraints.append(CSInCorrectButton1.centerYAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerYAnchor, constant: CGFloat(CSGCardChoicesY2)))
constraints.append(CSInCorrectButton2.widthAnchor.constraint(equalToConstant: 184))
constraints.append(CSInCorrectButton2.heightAnchor.constraint(equalToConstant: 83))
constraints.append(CSInCorrectButton2.centerXAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerXAnchor, constant: CGFloat(CSGCardChoicesX)))
constraints.append(CSInCorrectButton2.centerYAnchor.constraint(equalTo: view.safeAreaLayoutGuide.centerYAnchor, constant: CGFloat(CSGCardChoicesY3)))
NSLayoutConstraint.activate(constraints)
The buttons have been tested using TopAnchor, BottomAnchor, LeadingAnchor, TrailingAnchor as well.
I do not call viewWillNeedLayout after change. I will provide a code snippet as soon as I can tonight. I constrain to the safearealayout guide because it’s can change depending on which layout you use….ie..iPhone 16max, iPhone 16 Pro, iPhone SE…etc.
Even when I use Auto Layout Constraints, my button behavior reacts the same.
I also had to make sure my buttons went from "Touch Down" to "Primary Action Triggered"
Topic:
App & System Services
SubTopic:
General
Tags:
Apple Support answered my question, the answer was tvOS platform is a focused based platform, so my filled button was a focus object, which is why my button kept turning gray with a drop shadow. I am using all of my own graphics for my buttons moving forward for my tvOS video game app.
Topic:
App & System Services
SubTopic:
General
Tags: