Fix crash when displaying new status cells with polls

This commit is contained in:
Shadowfacts 2022-10-08 15:12:17 -04:00
parent 5b116c0d4e
commit 0fee770411
1 changed files with 11 additions and 9 deletions

View File

@ -38,9 +38,17 @@ class StatusPollView: UIView {
optionsView.isTracking optionsView.isTracking
} }
override func awakeFromNib() { override init(frame: CGRect) {
super.awakeFromNib() super.init(frame: .zero)
commonInit()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
commonInit()
}
private func commonInit() {
backgroundColor = .clear backgroundColor = .clear
optionsView = PollOptionsView(frame: .zero) optionsView = PollOptionsView(frame: .zero)
@ -55,12 +63,6 @@ class StatusPollView: UIView {
infoLabel.adjustsFontSizeToFitWidth = true infoLabel.adjustsFontSizeToFitWidth = true
addSubview(infoLabel) addSubview(infoLabel)
// voteButton = UIButton(type: .system)
// voteButton.translatesAutoresizingMaskIntoConstraints = false
// voteButton.addTarget(self, action: #selector(votePressed), for: .touchUpInside)
// voteButton.setTitle("Vote", for: .normal)
// voteButton.setTitleColor(.secondaryLabel, for: .disabled)
// voteButton.titleLabel!.font = infoLabel.font
voteButton = PollVoteButton() voteButton = PollVoteButton()
voteButton.translatesAutoresizingMaskIntoConstraints = false voteButton.translatesAutoresizingMaskIntoConstraints = false
voteButton.addTarget(self, action: #selector(votePressed)) voteButton.addTarget(self, action: #selector(votePressed))