forked from shadowfacts/Tusker
Make gallery control buttons square
This commit is contained in:
parent
b8fe0454b5
commit
d96ec2a732
|
@ -91,10 +91,11 @@ class GalleryItemViewController: UIViewController {
|
||||||
view.addSubview(topControlsView)
|
view.addSubview(topControlsView)
|
||||||
|
|
||||||
var shareConfig = UIButton.Configuration.gray()
|
var shareConfig = UIButton.Configuration.gray()
|
||||||
shareConfig.cornerStyle = .capsule
|
shareConfig.cornerStyle = .dynamic
|
||||||
shareConfig.background.backgroundColor = .black.withAlphaComponent(0.25)
|
shareConfig.background.backgroundColor = .black.withAlphaComponent(0.25)
|
||||||
shareConfig.baseForegroundColor = .white
|
shareConfig.baseForegroundColor = .white
|
||||||
shareConfig.image = UIImage(systemName: "square.and.arrow.up")
|
shareConfig.image = UIImage(systemName: "square.and.arrow.up")
|
||||||
|
shareConfig.contentInsets = NSDirectionalEdgeInsets(top: 4, leading: 4, bottom: 4, trailing: 4)
|
||||||
shareButton = UIButton(configuration: shareConfig)
|
shareButton = UIButton(configuration: shareConfig)
|
||||||
shareButton.addTarget(self, action: #selector(shareButtonPressed), for: .touchUpInside)
|
shareButton.addTarget(self, action: #selector(shareButtonPressed), for: .touchUpInside)
|
||||||
shareButton.isPointerInteractionEnabled = true
|
shareButton.isPointerInteractionEnabled = true
|
||||||
|
@ -106,10 +107,11 @@ class GalleryItemViewController: UIViewController {
|
||||||
topControlsView.addSubview(shareButton)
|
topControlsView.addSubview(shareButton)
|
||||||
|
|
||||||
var closeConfig = UIButton.Configuration.gray()
|
var closeConfig = UIButton.Configuration.gray()
|
||||||
closeConfig.cornerStyle = .capsule
|
closeConfig.cornerStyle = .dynamic
|
||||||
closeConfig.background.backgroundColor = .black.withAlphaComponent(0.25)
|
closeConfig.background.backgroundColor = .black.withAlphaComponent(0.25)
|
||||||
closeConfig.baseForegroundColor = .white
|
closeConfig.baseForegroundColor = .white
|
||||||
closeConfig.image = UIImage(systemName: "xmark")
|
closeConfig.image = UIImage(systemName: "xmark")
|
||||||
|
closeConfig.contentInsets = NSDirectionalEdgeInsets(top: 4, leading: 4, bottom: 4, trailing: 4)
|
||||||
let closeButton = UIButton(configuration: closeConfig)
|
let closeButton = UIButton(configuration: closeConfig)
|
||||||
closeButton.addTarget(self, action: #selector(closeButtonPressed), for: .touchUpInside)
|
closeButton.addTarget(self, action: #selector(closeButtonPressed), for: .touchUpInside)
|
||||||
closeButton.isPointerInteractionEnabled = true
|
closeButton.isPointerInteractionEnabled = true
|
||||||
|
@ -168,10 +170,12 @@ class GalleryItemViewController: UIViewController {
|
||||||
shareButtonLeadingConstraint,
|
shareButtonLeadingConstraint,
|
||||||
shareButtonTopConstraint,
|
shareButtonTopConstraint,
|
||||||
shareButton.bottomAnchor.constraint(equalTo: topControlsView.bottomAnchor),
|
shareButton.bottomAnchor.constraint(equalTo: topControlsView.bottomAnchor),
|
||||||
|
shareButton.widthAnchor.constraint(equalTo: shareButton.heightAnchor),
|
||||||
|
|
||||||
closeButtonTrailingConstraint,
|
closeButtonTrailingConstraint,
|
||||||
closeButtonTopConstraint,
|
closeButtonTopConstraint,
|
||||||
closeButton.bottomAnchor.constraint(equalTo: topControlsView.bottomAnchor),
|
closeButton.bottomAnchor.constraint(equalTo: topControlsView.bottomAnchor),
|
||||||
|
closeButton.widthAnchor.constraint(equalTo: closeButton.heightAnchor),
|
||||||
|
|
||||||
bottomControlsView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
bottomControlsView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
||||||
bottomControlsView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
bottomControlsView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
||||||
|
|
Loading…
Reference in New Issue