Skip to content

Commit

Permalink
Resolve shrinking collapse button problem
Browse files Browse the repository at this point in the history
  • Loading branch information
mojganii authored and buggmagnet committed Oct 8, 2024
1 parent 65bdbb5 commit ecd76bc
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions ios/MullvadVPN/View controllers/Tunnel/ConnectionPanelView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class ConnectionPanelView: UIView {

private let collapseView: ConnectionPanelCollapseView = {
let button = ConnectionPanelCollapseView()
button.axis = .horizontal
button.alignment = .top
button.distribution = .fill
button.translatesAutoresizingMaskIntoConstraints = false
button.tintColor = .white
return button
Expand Down Expand Up @@ -294,19 +297,22 @@ class ConnectionPanelCollapseView: UIStackView {
}()

private(set) var imageView: UIImageView = {
return UIImageView()
let imageView = UIImageView()
imageView.contentMode = .scaleAspectFit
return imageView
}()

override init(frame: CGRect) {
super.init(frame: frame)

let imageContainer = UIStackView()
imageContainer.axis = .vertical
imageContainer.addArrangedSubview(imageView)
imageContainer.addArrangedSubview(UIView()) // Pushes content up.

addArrangedSubview(title)
addArrangedSubview(imageContainer)
addArrangedSubview(imageView)

title.setContentHuggingPriority(.defaultLow, for: .horizontal)
title.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)

imageView.setContentHuggingPriority(.defaultHigh, for: .horizontal)
imageView.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
addArrangedSubview(UIView()) // Pushes content left.

updateImage()
Expand Down

0 comments on commit ecd76bc

Please sign in to comment.