Skip to content

Commit 78994d8

Browse files
author
Thomas Taschauer
committed
add menu
1 parent 76cb9e5 commit 78994d8

2 files changed

Lines changed: 37 additions & 13 deletions

File tree

OpenDocumentReader/DocumentViewController.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,20 @@ class DocumentViewController: UIViewController, DocumentDelegate {
121121
dismiss(animated: true, completion: nil)
122122
}
123123

124+
@IBAction func showMenu(_ sender: Any) {
125+
let alert = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
126+
alert.addAction(UIAlertAction(title: "Fullscreen", style: .default, handler: { (_) in
127+
self.toggleFullscreen()
128+
}))
129+
alert.addAction(UIAlertAction(title: "Print", style: .default, handler: { (_) in
130+
self.printDocument()
131+
}))
132+
alert.addAction(UIAlertAction(title: "Help!?", style: .default, handler: { (_) in
133+
self.showWebsite()
134+
}))
135+
self.present(alert, animated: true, completion: nil)
136+
}
137+
124138
func printDocument() {
125139
let printController = UIPrintInteractionController.shared
126140
let printInfo : UIPrintInfo = UIPrintInfo(dictionary: nil)

OpenDocumentReader/Main.storyboard

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
3-
<device id="retina4_7" orientation="portrait">
3+
<device id="retina4_0" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
@@ -18,7 +18,7 @@
1818
<viewControllerLayoutGuide type="bottom" id="hAi-w7-sTw"/>
1919
</layoutGuides>
2020
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
21-
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
21+
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
2222
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2323
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
2424
</view>
@@ -36,15 +36,14 @@
3636
<viewControllerLayoutGuide type="bottom" id="LvO-fG-AYW"/>
3737
</layoutGuides>
3838
<view key="view" contentMode="scaleToFill" id="SIE-Uh-Zny">
39-
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
39+
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
4040
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
4141
<subviews>
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"/>
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="320" height="568"/>
4544
<subviews>
46-
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="N1x-QM-Qks">
47-
<rect key="frame" x="0.0" y="0.0" width="375" height="64"/>
45+
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="N1x-QM-Qks">
46+
<rect key="frame" x="0.0" y="0.0" width="320" height="64"/>
4847
<constraints>
4948
<constraint firstAttribute="height" constant="64" id="7HG-pa-6VL"/>
5049
<constraint firstAttribute="height" priority="999" constant="44" id="wgs-N3-sP6"/>
@@ -56,7 +55,12 @@
5655
</connections>
5756
</barButtonItem>
5857
<barButtonItem style="plain" systemItem="flexibleSpace" id="lgr-dX-fUO"/>
59-
<barButtonItem style="plain" systemItem="action" id="Wnb-un-pvc"/>
58+
<barButtonItem systemItem="action" id="Vsd-IL-ujz">
59+
<inset key="imageInsets" minX="0.0" minY="8" maxX="0.0" maxY="0.0"/>
60+
<connections>
61+
<action selector="showMenu:" destination="M2k-L8-Olo" id="ZQ1-Aa-9D0"/>
62+
</connections>
63+
</barButtonItem>
6064
</items>
6165
<variation key="default">
6266
<mask key="constraints">
@@ -71,17 +75,17 @@
7175
</variation>
7276
</toolbar>
7377
<view hidden="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sIx-zo-9kG" customClass="ScrollableSegmentedControl" customModule="ScrollableSegmentedControl">
74-
<rect key="frame" x="0.0" y="64" width="375" height="30"/>
78+
<rect key="frame" x="0.0" y="64" width="320" height="30"/>
7579
<color key="backgroundColor" red="0.97636479139328003" green="0.97653168439865112" blue="0.97635418176651001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
7680
<constraints>
7781
<constraint firstAttribute="height" constant="30" id="P24-FV-92V"/>
7882
</constraints>
7983
</view>
8084
<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"/>
85+
<rect key="frame" x="0.0" y="64" width="320" height="0.0"/>
8286
</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"/>
87+
<wkWebView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="VF5-Do-xh9">
88+
<rect key="frame" x="0.0" y="64" width="320" height="504"/>
8589
<color key="backgroundColor" red="0.36078431370000003" green="0.38823529410000002" blue="0.4039215686" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
8690
<wkWebViewConfiguration key="configuration">
8791
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
@@ -92,6 +96,12 @@
9296
</stackView>
9397
</subviews>
9498
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
99+
<constraints>
100+
<constraint firstItem="9mi-yf-jXf" firstAttribute="leading" secondItem="SIE-Uh-Zny" secondAttribute="leadingMargin" constant="-16" id="5Hh-GZ-aPw"/>
101+
<constraint firstItem="9mi-yf-jXf" firstAttribute="bottom" secondItem="SIE-Uh-Zny" secondAttribute="bottom" id="WfC-A6-p6P"/>
102+
<constraint firstItem="9mi-yf-jXf" firstAttribute="top" secondItem="SIE-Uh-Zny" secondAttribute="top" id="rED-wA-6gv"/>
103+
<constraint firstAttribute="trailingMargin" secondItem="9mi-yf-jXf" secondAttribute="trailing" constant="-16" id="tPc-vX-Egd"/>
104+
</constraints>
95105
</view>
96106
<connections>
97107
<outlet property="progressBar" destination="ePk-bQ-fV8" id="nz6-qw-ouf"/>

0 commit comments

Comments
 (0)