From 0fee770411d0b28c6dfa57443ffc45a367907224 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 8 Oct 2022 15:12:17 -0400 Subject: [PATCH] Fix crash when displaying new status cells with polls --- Tusker/Views/Poll/StatusPollView.swift | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Tusker/Views/Poll/StatusPollView.swift b/Tusker/Views/Poll/StatusPollView.swift index 484d7754..fb24abd1 100644 --- a/Tusker/Views/Poll/StatusPollView.swift +++ b/Tusker/Views/Poll/StatusPollView.swift @@ -38,9 +38,17 @@ class StatusPollView: UIView { optionsView.isTracking } - override func awakeFromNib() { - super.awakeFromNib() - + override init(frame: CGRect) { + super.init(frame: .zero) + commonInit() + } + + required init?(coder: NSCoder) { + super.init(coder: coder) + commonInit() + } + + private func commonInit() { backgroundColor = .clear optionsView = PollOptionsView(frame: .zero) @@ -55,12 +63,6 @@ class StatusPollView: UIView { infoLabel.adjustsFontSizeToFitWidth = true 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.translatesAutoresizingMaskIntoConstraints = false voteButton.addTarget(self, action: #selector(votePressed))