Fix strange large image VC presentation animation

Workaround for using XIB instead of storyboard

Closes #4
This commit is contained in:
Shadowfacts 2018-10-29 19:56:05 -04:00
parent 82d4fe22cf
commit 7eb377ec6b
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 9 additions and 2 deletions

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.23.1" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14460.30.1" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait"> <device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/> <adaptation id="fullscreen"/>
</device> </device>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.16.1"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.19.1"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>

View File

@ -51,6 +51,13 @@ class LargeImageExpandAnimationController: NSObject, UIViewControllerAnimatedTra
imageView.layer.cornerRadius = 0 imageView.layer.cornerRadius = 0
blackView.alpha = 1 blackView.alpha = 1
}, completion: { _ in }, 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 toVC.view.isHidden = false
fromVC.view.isHidden = false fromVC.view.isHidden = false
blackView.removeFromSuperview() blackView.removeFromSuperview()