Fix some images scrolling unnecesarily in LargeImageViewController

This commit is contained in:
Shadowfacts 2019-07-29 11:38:57 -04:00
parent 509e013380
commit 9a6723a895
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 3 additions and 9 deletions

View File

@ -182,11 +182,9 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate {
func centerImage() { func centerImage() {
let yOffset = max(0, (view.bounds.size.height - imageView.frame.height) / 2) let yOffset = max(0, (view.bounds.size.height - imageView.frame.height) / 2)
imageViewTopConstraint.constant = yOffset imageViewTopConstraint.constant = yOffset
imageViewBottomConstraint.constant = yOffset
let xOffset = max(0, (view.bounds.size.width - imageView.frame.width) / 2) let xOffset = max(0, (view.bounds.size.width - imageView.frame.width) / 2)
imageViewLeadingConstraint.constant = xOffset imageViewLeadingConstraint.constant = xOffset
imageViewTrailingConstraint.constant = xOffset
} }
func zoomRectFor(scale: CGFloat, center: CGPoint) -> CGRect { func zoomRectFor(scale: CGFloat, center: CGPoint) -> CGRect {

View File

@ -1,8 +1,8 @@
<?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="14810.11" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14845" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/> <device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14766.13"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14799.2"/>
<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>
@ -15,10 +15,8 @@
<outlet property="closeButtonTrailingConstraint" destination="JFe-ig-3Ic" id="cWO-Rr-y3F"/> <outlet property="closeButtonTrailingConstraint" destination="JFe-ig-3Ic" id="cWO-Rr-y3F"/>
<outlet property="descriptionLabel" destination="eo5-fc-RV8" id="vrW-RJ-y5k"/> <outlet property="descriptionLabel" destination="eo5-fc-RV8" id="vrW-RJ-y5k"/>
<outlet property="imageView" destination="qcn-1t-3sS" id="Q01-G2-y1c"/> <outlet property="imageView" destination="qcn-1t-3sS" id="Q01-G2-y1c"/>
<outlet property="imageViewBottomConstraint" destination="3JF-Yo-5OR" id="1dh-W6-E8S"/>
<outlet property="imageViewLeadingConstraint" destination="bI3-V8-M70" id="nIe-xI-E9u"/> <outlet property="imageViewLeadingConstraint" destination="bI3-V8-M70" id="nIe-xI-E9u"/>
<outlet property="imageViewTopConstraint" destination="tfL-hp-2I2" id="EDV-RO-pTe"/> <outlet property="imageViewTopConstraint" destination="tfL-hp-2I2" id="EDV-RO-pTe"/>
<outlet property="imageViewTrailingConstraint" destination="3bU-AI-KLl" id="IRq-jZ-u2s"/>
<outlet property="scrollView" destination="Skj-xq-AgQ" id="TFb-zF-m1b"/> <outlet property="scrollView" destination="Skj-xq-AgQ" id="TFb-zF-m1b"/>
<outlet property="shareButton" destination="vhp-0u-Q0S" id="JZS-K9-4w9"/> <outlet property="shareButton" destination="vhp-0u-Q0S" id="JZS-K9-4w9"/>
<outlet property="shareButtonLeadingConstraint" destination="MJx-2r-p0k" id="Dn5-Eg-Pid"/> <outlet property="shareButtonLeadingConstraint" destination="MJx-2r-p0k" id="Dn5-Eg-Pid"/>
@ -43,8 +41,6 @@
</subviews> </subviews>
<gestureRecognizers/> <gestureRecognizers/>
<constraints> <constraints>
<constraint firstAttribute="bottom" secondItem="qcn-1t-3sS" secondAttribute="bottom" id="3JF-Yo-5OR"/>
<constraint firstAttribute="trailing" secondItem="qcn-1t-3sS" secondAttribute="trailing" id="3bU-AI-KLl"/>
<constraint firstItem="qcn-1t-3sS" firstAttribute="leading" secondItem="Skj-xq-AgQ" secondAttribute="leading" id="bI3-V8-M70"/> <constraint firstItem="qcn-1t-3sS" firstAttribute="leading" secondItem="Skj-xq-AgQ" secondAttribute="leading" id="bI3-V8-M70"/>
<constraint firstItem="qcn-1t-3sS" firstAttribute="top" secondItem="Skj-xq-AgQ" secondAttribute="top" id="tfL-hp-2I2"/> <constraint firstItem="qcn-1t-3sS" firstAttribute="top" secondItem="Skj-xq-AgQ" secondAttribute="top" id="tfL-hp-2I2"/>
</constraints> </constraints>