From 7eb377ec6be488e08bd795fcb32cbe0ae4fa1e15 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 29 Oct 2018 19:56:05 -0400 Subject: [PATCH] Fix strange large image VC presentation animation Workaround for using XIB instead of storyboard Closes #4 --- Tusker/Screens/Large Image/LargeImageViewController.xib | 4 ++-- .../Transitions/LargeImageExpandAnimationController.swift | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Tusker/Screens/Large Image/LargeImageViewController.xib b/Tusker/Screens/Large Image/LargeImageViewController.xib index 60b8f120..023aa143 100644 --- a/Tusker/Screens/Large Image/LargeImageViewController.xib +++ b/Tusker/Screens/Large Image/LargeImageViewController.xib @@ -1,10 +1,10 @@ - + - + diff --git a/Tusker/Screens/Large Image/Transitions/LargeImageExpandAnimationController.swift b/Tusker/Screens/Large Image/Transitions/LargeImageExpandAnimationController.swift index 8378a188..83f90b73 100644 --- a/Tusker/Screens/Large Image/Transitions/LargeImageExpandAnimationController.swift +++ b/Tusker/Screens/Large Image/Transitions/LargeImageExpandAnimationController.swift @@ -51,6 +51,13 @@ class LargeImageExpandAnimationController: NSObject, UIViewControllerAnimatedTra imageView.layer.cornerRadius = 0 blackView.alpha = 1 }, completion: { _ in + // This shouldn't be necessary. I believe it's a workaround for using a XIB + // for the large image VC. Without this, the final frame of the large image VC + // is not set to the propper rect (it uses the frame of the preview device + // in the XIB). When using a storyboard, the final frame is automatically set + // (or UIKit does layout differently when loading the view) and this is not necessary. + toVC.view.frame = finalVCFrame + toVC.view.isHidden = false fromVC.view.isHidden = false blackView.removeFromSuperview()