Skip to content

Commit 76cb9e5

Browse files
author
Thomas Taschauer
committed
show progress bar at the top
1 parent 592406a commit 76cb9e5

2 files changed

Lines changed: 13 additions & 20 deletions

File tree

OpenDocumentReader/Document.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Document: UIDocument {
2222
public var pageNames: [String]?
2323

2424
public weak var delegate: DocumentDelegate?
25-
public var loadProgress = Progress(totalUnitCount: 1)
25+
public var loadProgress = Progress(totalUnitCount: 5)
2626

2727
private var page: Int = 0
2828
private var password: String?
@@ -40,7 +40,7 @@ class Document: UIDocument {
4040
func parse() {
4141
delegate?.documentLoadingStarted(self)
4242

43-
loadProgress.completedUnitCount = 0
43+
loadProgress.completedUnitCount = 2
4444
loadProgress.resume()
4545

4646
result = nil

OpenDocumentReader/Main.storyboard

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@
3939
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
4040
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
4141
<subviews>
42-
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="9mi-yf-jXf">
43-
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
42+
<stackView opaque="NO" contentMode="scaleToFill" fixedFrame="YES" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="9mi-yf-jXf">
43+
<rect key="frame" x="0.0" y="0.0" width="375" height="612"/>
44+
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
4445
<subviews>
45-
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="N1x-QM-Qks">
46+
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="N1x-QM-Qks">
4647
<rect key="frame" x="0.0" y="0.0" width="375" height="64"/>
4748
<constraints>
4849
<constraint firstAttribute="height" constant="64" id="7HG-pa-6VL"/>
@@ -55,6 +56,7 @@
5556
</connections>
5657
</barButtonItem>
5758
<barButtonItem style="plain" systemItem="flexibleSpace" id="lgr-dX-fUO"/>
59+
<barButtonItem style="plain" systemItem="action" id="Wnb-un-pvc"/>
5860
</items>
5961
<variation key="default">
6062
<mask key="constraints">
@@ -68,15 +70,18 @@
6870
</mask>
6971
</variation>
7072
</toolbar>
71-
<view contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sIx-zo-9kG" customClass="ScrollableSegmentedControl" customModule="ScrollableSegmentedControl">
73+
<view hidden="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sIx-zo-9kG" customClass="ScrollableSegmentedControl" customModule="ScrollableSegmentedControl">
7274
<rect key="frame" x="0.0" y="64" width="375" height="30"/>
7375
<color key="backgroundColor" red="0.97636479139328003" green="0.97653168439865112" blue="0.97635418176651001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
7476
<constraints>
7577
<constraint firstAttribute="height" constant="30" id="P24-FV-92V"/>
7678
</constraints>
7779
</view>
78-
<wkWebView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="VF5-Do-xh9">
79-
<rect key="frame" x="0.0" y="94" width="375" height="573"/>
80+
<progressView hidden="YES" opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" progress="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="ePk-bQ-fV8">
81+
<rect key="frame" x="0.0" y="64" width="375" height="0.0"/>
82+
</progressView>
83+
<wkWebView contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="VF5-Do-xh9">
84+
<rect key="frame" x="0.0" y="64" width="375" height="548"/>
8085
<color key="backgroundColor" red="0.36078431370000003" green="0.38823529410000002" blue="0.4039215686" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
8186
<wkWebViewConfiguration key="configuration">
8287
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
@@ -85,20 +90,8 @@
8590
</wkWebView>
8691
</subviews>
8792
</stackView>
88-
<progressView hidden="YES" opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" progress="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="ePk-bQ-fV8">
89-
<rect key="frame" x="20" y="332.5" width="335" height="2"/>
90-
</progressView>
9193
</subviews>
9294
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
93-
<constraints>
94-
<constraint firstItem="ePk-bQ-fV8" firstAttribute="centerY" secondItem="SIE-Uh-Zny" secondAttribute="centerY" id="Lsn-Is-SL7"/>
95-
<constraint firstItem="9mi-yf-jXf" firstAttribute="leading" secondItem="SIE-Uh-Zny" secondAttribute="leadingMargin" constant="-16" id="UTs-f9-tNS"/>
96-
<constraint firstAttribute="trailingMargin" secondItem="ePk-bQ-fV8" secondAttribute="trailing" constant="4" id="ce7-QQ-IaX"/>
97-
<constraint firstItem="ePk-bQ-fV8" firstAttribute="leading" secondItem="SIE-Uh-Zny" secondAttribute="leadingMargin" constant="4" id="fgT-yN-VCT"/>
98-
<constraint firstAttribute="bottom" secondItem="9mi-yf-jXf" secondAttribute="bottom" id="mfM-uu-maw"/>
99-
<constraint firstItem="9mi-yf-jXf" firstAttribute="top" secondItem="SIE-Uh-Zny" secondAttribute="top" id="tub-Q4-eAe"/>
100-
<constraint firstAttribute="trailingMargin" secondItem="9mi-yf-jXf" secondAttribute="trailing" constant="-16" id="uCU-E7-seO"/>
101-
</constraints>
10295
</view>
10396
<connections>
10497
<outlet property="progressBar" destination="ePk-bQ-fV8" id="nz6-qw-ouf"/>

0 commit comments

Comments
 (0)