Large Image VC: Hide home indicator when controls hidden

This commit is contained in:
Shadowfacts 2019-06-14 14:46:19 -07:00
parent 730308df3f
commit ea143ea0dd
Signed by untrusted user: shadowfacts
GPG Key ID: 83FB3304046BADA4
1 changed files with 7 additions and 1 deletions

View File

@ -43,6 +43,8 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate {
var controlsVisible = true { var controlsVisible = true {
didSet { didSet {
setNeedsUpdateOfHomeIndicatorAutoHidden()
UIView.animate(withDuration: 0.2) { UIView.animate(withDuration: 0.2) {
let topOffset = self.controlsVisible ? 0 : -self.topControlsView.bounds.height let topOffset = self.controlsVisible ? 0 : -self.topControlsView.bounds.height
self.topControlsView.transform = CGAffineTransform(translationX: 0, y: topOffset) self.topControlsView.transform = CGAffineTransform(translationX: 0, y: topOffset)
@ -60,7 +62,11 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate {
return true return true
} }
init(image: UIImage, description: String?, sourceFrame: CGRect, sourceCornerRadius: CGFloat) { override var prefersHomeIndicatorAutoHidden: Bool {
return !controlsVisible
}
init(image: UIImage, description: String?, sourceFrame: CGRect?, sourceCornerRadius: CGFloat?) {
self.image = image self.image = image
self.imageDescription = description self.imageDescription = description
self.originFrame = sourceFrame self.originFrame = sourceFrame