toc finished

This commit is contained in:
Chris Li 2017-01-05 15:06:41 -05:00
parent 95af50d895
commit 1fc0efcfd5
4 changed files with 72 additions and 49 deletions

View File

@ -266,15 +266,15 @@ extension MainController: TableOfContentsDelegate {
func configureTOCConstraints() { func configureTOCConstraints() {
switch traitCollection.horizontalSizeClass { switch traitCollection.horizontalSizeClass {
case .compact: case .compact:
let toolBarHeight: CGFloat = traitCollection.horizontalSizeClass == .regular ? 0.0 : (traitCollection.verticalSizeClass == .compact ? 32.0 : 44.0)
let tocHeight: CGFloat = { let tocHeight: CGFloat = {
guard let controller = tableOfContentsController else {return floor(view.frame.height * 0.4)} guard let controller = tableOfContentsController else {return floor(view.frame.height * 0.4)}
let tocContentHeight = controller.tableView.contentSize.height let tocContentHeight = controller.tableView.contentSize.height
guard controller.headings.count != 0 else {return floor(view.frame.height * 0.4)} guard controller.headings.count != 0 else {return floor(view.frame.height * 0.4)}
let toolBarHeight: CGFloat = traitCollection.horizontalSizeClass == .regular ? 0.0 : (traitCollection.verticalSizeClass == .compact ? 32.0 : 44.0) return min(tocContentHeight, floor(view.frame.height * 0.65))
return min(tocContentHeight + toolBarHeight, floor(view.frame.height * 0.65))
}() }()
tocHeightConstraint.constant = tocHeight tocHeightConstraint.constant = tocHeight
tocTopToSuperViewBottomSpacing.constant = isShowingTableOfContents ? tocHeight : 0.0 tocTopToSuperViewBottomSpacing.constant = isShowingTableOfContents ? tocHeight + toolBarHeight + 10 : 0.0
case .regular: case .regular:
tocLeadSpacing.constant = isShowingTableOfContents ? 0.0 : 270 tocLeadSpacing.constant = isShowingTableOfContents ? 0.0 : 270
default: default:

View File

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11760" systemVersion="16B2555" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="uuM-WO-DyB"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="uuM-WO-DyB">
<device id="retina5_5" orientation="portrait"> <device id="retina5_5" orientation="portrait">
<adaptation id="fullscreen"/> <adaptation id="fullscreen"/>
</device> </device>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11755"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<capability name="Alignment constraints with different attributes" minToolsVersion="5.1"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/> <capability name="Constraints to layout margins" minToolsVersion="6.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>
@ -23,7 +24,7 @@
<rect key="frame" x="0.0" y="28" width="414" height="44"/> <rect key="frame" x="0.0" y="28" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="r7E-6T-nCU" id="MHm-bs-fau"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="r7E-6T-nCU" id="MHm-bs-fau">
<rect key="frame" x="0.0" y="0.0" width="414" height="43.5"/> <rect key="frame" x="0.0" y="0.0" width="414" height="43"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView> </tableViewCellContentView>
</tableViewCell> </tableViewCell>
@ -47,22 +48,22 @@
<viewControllerLayoutGuide type="bottom" id="4FP-XB-FlM"/> <viewControllerLayoutGuide type="bottom" id="4FP-XB-FlM"/>
</layoutGuides> </layoutGuides>
<view key="view" contentMode="scaleToFill" id="ckI-RJ-vNm"> <view key="view" contentMode="scaleToFill" id="ckI-RJ-vNm">
<rect key="frame" x="0.0" y="0.0" width="414" height="390"/> <rect key="frame" x="0.0" y="0.0" width="394" height="390"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="xpu-sV-k1z"> <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="xpu-sV-k1z">
<rect key="frame" x="0.0" y="0.0" width="414" height="390"/> <rect key="frame" x="0.0" y="0.0" width="394" height="390"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<prototypes> <prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="H1Cell" textLabel="xPq-dt-NK6" style="IBUITableViewCellStyleDefault" id="DSn-3Y-Gs4"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="H1Cell" textLabel="xPq-dt-NK6" style="IBUITableViewCellStyleDefault" id="DSn-3Y-Gs4">
<rect key="frame" x="0.0" y="28" width="414" height="44"/> <rect key="frame" x="0.0" y="28" width="394" height="44"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="DSn-3Y-Gs4" id="vq5-6x-vLY"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="DSn-3Y-Gs4" id="vq5-6x-vLY">
<rect key="frame" x="0.0" y="0.0" width="414" height="43.5"/> <rect key="frame" x="0.0" y="0.0" width="394" height="43"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="xPq-dt-NK6"> <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="xPq-dt-NK6">
<rect key="frame" x="15" y="0.0" width="384" height="43.666666666666664"/> <rect key="frame" x="15" y="0.0" width="364" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/> <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -77,14 +78,14 @@
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</tableViewCell> </tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="H2Cell" textLabel="DJX-Kf-59M" style="IBUITableViewCellStyleDefault" id="au4-iz-tLz"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="H2Cell" textLabel="DJX-Kf-59M" style="IBUITableViewCellStyleDefault" id="au4-iz-tLz">
<rect key="frame" x="0.0" y="72" width="414" height="44"/> <rect key="frame" x="0.0" y="72" width="394" height="44"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="au4-iz-tLz" id="3UD-lZ-hs0"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="au4-iz-tLz" id="3UD-lZ-hs0">
<rect key="frame" x="0.0" y="0.0" width="414" height="43.5"/> <rect key="frame" x="0.0" y="0.0" width="394" height="43"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="DJX-Kf-59M"> <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="DJX-Kf-59M">
<rect key="frame" x="15" y="0.0" width="384" height="43.666666666666664"/> <rect key="frame" x="15" y="0.0" width="364" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -99,14 +100,14 @@
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
</tableViewCell> </tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" textLabel="ry7-2s-QyS" style="IBUITableViewCellStyleDefault" id="cam-ik-ZIw"> <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" textLabel="ry7-2s-QyS" style="IBUITableViewCellStyleDefault" id="cam-ik-ZIw">
<rect key="frame" x="0.0" y="116" width="414" height="44"/> <rect key="frame" x="0.0" y="116" width="394" height="44"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="cam-ik-ZIw" id="ooG-35-3Wp"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="cam-ik-ZIw" id="ooG-35-3Wp">
<rect key="frame" x="0.0" y="0.0" width="414" height="43.5"/> <rect key="frame" x="0.0" y="0.0" width="394" height="43"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="ry7-2s-QyS"> <label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="ry7-2s-QyS">
<rect key="frame" x="15" y="0.0" width="384" height="43.666666666666664"/> <rect key="frame" x="15" y="0.0" width="364" height="43"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/> <fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@ -150,7 +151,6 @@
<constraint firstAttribute="topMargin" secondItem="tZq-RO-dRD" secondAttribute="top" id="dqr-qp-yJh"/> <constraint firstAttribute="topMargin" secondItem="tZq-RO-dRD" secondAttribute="top" id="dqr-qp-yJh"/>
<constraint firstItem="tZq-RO-dRD" firstAttribute="leading" secondItem="xpu-sV-k1z" secondAttribute="trailing" id="gyA-z0-8v8"/> <constraint firstItem="tZq-RO-dRD" firstAttribute="leading" secondItem="xpu-sV-k1z" secondAttribute="trailing" id="gyA-z0-8v8"/>
<constraint firstAttribute="trailing" secondItem="tZq-RO-dRD" secondAttribute="trailing" id="olA-XZ-0EX"/> <constraint firstAttribute="trailing" secondItem="tZq-RO-dRD" secondAttribute="trailing" id="olA-XZ-0EX"/>
<constraint firstItem="4FP-XB-FlM" firstAttribute="top" secondItem="xpu-sV-k1z" secondAttribute="bottom" id="sDJ-uZ-sXQ"/>
<constraint firstAttribute="bottom" secondItem="xpu-sV-k1z" secondAttribute="bottom" id="tqu-A9-BxO"/> <constraint firstAttribute="bottom" secondItem="xpu-sV-k1z" secondAttribute="bottom" id="tqu-A9-BxO"/>
<constraint firstAttribute="bottom" secondItem="tZq-RO-dRD" secondAttribute="bottom" id="y5a-P4-Smx"/> <constraint firstAttribute="bottom" secondItem="tZq-RO-dRD" secondAttribute="bottom" id="y5a-P4-Smx"/>
</constraints> </constraints>
@ -159,17 +159,14 @@
<exclude reference="tZq-RO-dRD"/> <exclude reference="tZq-RO-dRD"/>
</mask> </mask>
<mask key="constraints"> <mask key="constraints">
<exclude reference="FgY-e7-gFD"/>
<exclude reference="olA-XZ-0EX"/> <exclude reference="olA-XZ-0EX"/>
<exclude reference="y5a-P4-Smx"/> <exclude reference="y5a-P4-Smx"/>
<exclude reference="FgY-e7-gFD"/>
<exclude reference="tqu-A9-BxO"/>
<exclude reference="sDJ-uZ-sXQ"/>
</mask> </mask>
</variation> </variation>
<variation key="widthClass=compact"> <variation key="widthClass=compact">
<mask key="constraints"> <mask key="constraints">
<include reference="FgY-e7-gFD"/> <include reference="FgY-e7-gFD"/>
<include reference="sDJ-uZ-sXQ"/>
</mask> </mask>
</variation> </variation>
<variation key="widthClass=regular"> <variation key="widthClass=regular">
@ -177,10 +174,9 @@
<include reference="tZq-RO-dRD"/> <include reference="tZq-RO-dRD"/>
</mask> </mask>
<mask key="constraints"> <mask key="constraints">
<exclude reference="FgY-e7-gFD"/>
<include reference="olA-XZ-0EX"/> <include reference="olA-XZ-0EX"/>
<include reference="y5a-P4-Smx"/> <include reference="y5a-P4-Smx"/>
<exclude reference="FgY-e7-gFD"/>
<include reference="tqu-A9-BxO"/>
</mask> </mask>
</variation> </variation>
</view> </view>
@ -210,14 +206,22 @@
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<dataDetectorType key="dataDetectorTypes"/> <dataDetectorType key="dataDetectorTypes"/>
</webView> </webView>
<visualEffectView hidden="YES" opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="r0g-Y2-P3v"> <view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="K9J-LG-g2K">
<rect key="frame" x="0.0" y="736" width="414" height="390"/> <rect key="frame" x="0.0" y="64" width="414" height="628"/>
<color key="backgroundColor" red="0.33333333333333331" green="0.33333333333333331" blue="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<gestureRecognizers/>
<connections>
<outletCollection property="gestureRecognizers" destination="NUn-UO-p8Y" appends="YES" id="sK9-4I-XpH"/>
</connections>
</view>
<visualEffectView hidden="YES" opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="r0g-Y2-P3v" customClass="TOCRoundedCornerVisualEffectView" customModule="Kiwix" customModuleProvider="target">
<rect key="frame" x="10" y="736" width="394" height="390"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="duR-pa-KCb"> <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="duR-pa-KCb">
<rect key="frame" x="0.0" y="0.0" width="414" height="390"/> <rect key="frame" x="0.0" y="0.0" width="394" height="390"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="U3d-ZH-PNu"> <containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="U3d-ZH-PNu">
<rect key="frame" x="0.0" y="0.0" width="414" height="390"/> <rect key="frame" x="0.0" y="0.0" width="394" height="390"/>
<connections> <connections>
<segue destination="H9F-uX-e8a" kind="embed" identifier="EmbeddedTOCController" id="s9S-4d-udJ"/> <segue destination="H9F-uX-e8a" kind="embed" identifier="EmbeddedTOCController" id="s9S-4d-udJ"/>
</connections> </connections>
@ -254,6 +258,7 @@
</mask> </mask>
</variation> </variation>
</view> </view>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="270" id="EC0-IZ-NeD"/> <constraint firstAttribute="width" constant="270" id="EC0-IZ-NeD"/>
<constraint firstAttribute="height" constant="390" id="Hbh-Zr-Fie"/> <constraint firstAttribute="height" constant="390" id="Hbh-Zr-Fie"/>
@ -276,19 +281,11 @@
</mask> </mask>
</variation> </variation>
</visualEffectView> </visualEffectView>
<view hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="K9J-LG-g2K">
<rect key="frame" x="0.0" y="64" width="414" height="672"/>
<color key="backgroundColor" red="0.33333333333333331" green="0.33333333333333331" blue="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<gestureRecognizers/>
<connections>
<outletCollection property="gestureRecognizers" destination="NUn-UO-p8Y" appends="YES" id="sK9-4I-XpH"/>
</connections>
</view>
</subviews> </subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints> <constraints>
<constraint firstAttribute="leading" secondItem="r0g-Y2-P3v" secondAttribute="leading" constant="270" id="6b5-8X-7aD"/> <constraint firstAttribute="leading" secondItem="r0g-Y2-P3v" secondAttribute="leading" constant="270" id="6b5-8X-7aD"/>
<constraint firstItem="r0g-Y2-P3v" firstAttribute="leading" secondItem="BDO-xK-ZEa" secondAttribute="leading" id="AwJ-A8-0MO"/> <constraint firstItem="r0g-Y2-P3v" firstAttribute="leading" secondItem="BDO-xK-ZEa" secondAttribute="leading" constant="10" id="AwJ-A8-0MO"/>
<constraint firstItem="hIy-lu-2F6" firstAttribute="leading" secondItem="BDO-xK-ZEa" secondAttribute="leading" id="Gde-Fa-kB8"/> <constraint firstItem="hIy-lu-2F6" firstAttribute="leading" secondItem="BDO-xK-ZEa" secondAttribute="leading" id="Gde-Fa-kB8"/>
<constraint firstItem="r0g-Y2-P3v" firstAttribute="top" secondItem="HS5-a8-H6G" secondAttribute="bottom" id="JwF-38-cyF"/> <constraint firstItem="r0g-Y2-P3v" firstAttribute="top" secondItem="HS5-a8-H6G" secondAttribute="bottom" id="JwF-38-cyF"/>
<constraint firstItem="hIy-lu-2F6" firstAttribute="top" secondItem="HS5-a8-H6G" secondAttribute="bottom" constant="-64" id="Ooa-c6-8q6"> <constraint firstItem="hIy-lu-2F6" firstAttribute="top" secondItem="HS5-a8-H6G" secondAttribute="bottom" constant="-64" id="Ooa-c6-8q6">
@ -296,7 +293,7 @@
<variation key="heightClass=compact-widthClass=compact" constant="-32"/> <variation key="heightClass=compact-widthClass=compact" constant="-32"/>
<variation key="heightClass=compact-widthClass=regular" constant="-44"/> <variation key="heightClass=compact-widthClass=regular" constant="-44"/>
</constraint> </constraint>
<constraint firstItem="r0g-Y2-P3v" firstAttribute="top" secondItem="K9J-LG-g2K" secondAttribute="bottom" id="V1f-UR-jH8"/> <constraint firstItem="fXQ-NS-gMx" firstAttribute="top" secondItem="K9J-LG-g2K" secondAttribute="bottom" id="QYO-fy-GYr"/>
<constraint firstItem="fXQ-NS-gMx" firstAttribute="top" secondItem="hIy-lu-2F6" secondAttribute="bottom" constant="-44" id="WOB-MJ-B5Z"> <constraint firstItem="fXQ-NS-gMx" firstAttribute="top" secondItem="hIy-lu-2F6" secondAttribute="bottom" constant="-44" id="WOB-MJ-B5Z">
<variation key="widthClass=regular" constant="0.0"/> <variation key="widthClass=regular" constant="0.0"/>
<variation key="heightClass=compact-widthClass=compact" constant="-32"/> <variation key="heightClass=compact-widthClass=compact" constant="-32"/>
@ -307,41 +304,41 @@
<constraint firstAttribute="trailing" secondItem="K9J-LG-g2K" secondAttribute="trailing" id="fNo-Ba-KRO"/> <constraint firstAttribute="trailing" secondItem="K9J-LG-g2K" secondAttribute="trailing" id="fNo-Ba-KRO"/>
<constraint firstItem="K9J-LG-g2K" firstAttribute="leading" secondItem="BDO-xK-ZEa" secondAttribute="leading" id="ieA-8B-e1X"/> <constraint firstItem="K9J-LG-g2K" firstAttribute="leading" secondItem="BDO-xK-ZEa" secondAttribute="leading" id="ieA-8B-e1X"/>
<constraint firstItem="hIy-lu-2F6" firstAttribute="leading" secondItem="r0g-Y2-P3v" secondAttribute="trailing" id="j9u-OA-K4W"/> <constraint firstItem="hIy-lu-2F6" firstAttribute="leading" secondItem="r0g-Y2-P3v" secondAttribute="trailing" id="j9u-OA-K4W"/>
<constraint firstAttribute="trailing" secondItem="r0g-Y2-P3v" secondAttribute="trailing" id="qvn-rd-wza"/> <constraint firstAttribute="trailing" secondItem="r0g-Y2-P3v" secondAttribute="trailing" constant="10" id="qvn-rd-wza"/>
<constraint firstItem="fXQ-NS-gMx" firstAttribute="top" secondItem="r0g-Y2-P3v" secondAttribute="bottom" id="wIQ-Lv-buV"/> <constraint firstItem="fXQ-NS-gMx" firstAttribute="top" secondItem="r0g-Y2-P3v" secondAttribute="bottom" id="wIQ-Lv-buV"/>
<constraint firstItem="K9J-LG-g2K" firstAttribute="top" secondItem="HS5-a8-H6G" secondAttribute="bottom" priority="750" id="xcv-M9-m5f"/> <constraint firstItem="K9J-LG-g2K" firstAttribute="top" secondItem="HS5-a8-H6G" secondAttribute="bottom" priority="750" id="xcv-M9-m5f"/>
</constraints> </constraints>
<variation key="default"> <variation key="default">
<mask key="subviews"> <mask key="subviews">
<exclude reference="r0g-Y2-P3v"/>
<exclude reference="K9J-LG-g2K"/> <exclude reference="K9J-LG-g2K"/>
<exclude reference="r0g-Y2-P3v"/>
</mask> </mask>
<mask key="constraints"> <mask key="constraints">
<exclude reference="wIQ-Lv-buV"/> <exclude reference="j9u-OA-K4W"/>
<exclude reference="fNo-Ba-KRO"/> <exclude reference="fNo-Ba-KRO"/>
<exclude reference="ieA-8B-e1X"/> <exclude reference="ieA-8B-e1X"/>
<exclude reference="xcv-M9-m5f"/> <exclude reference="xcv-M9-m5f"/>
<exclude reference="j9u-OA-K4W"/> <exclude reference="QYO-fy-GYr"/>
<exclude reference="wIQ-Lv-buV"/>
<exclude reference="6b5-8X-7aD"/> <exclude reference="6b5-8X-7aD"/>
<exclude reference="AwJ-A8-0MO"/> <exclude reference="AwJ-A8-0MO"/>
<exclude reference="JwF-38-cyF"/> <exclude reference="JwF-38-cyF"/>
<exclude reference="V1f-UR-jH8"/>
<exclude reference="c3k-qN-lYX"/> <exclude reference="c3k-qN-lYX"/>
<exclude reference="qvn-rd-wza"/> <exclude reference="qvn-rd-wza"/>
</mask> </mask>
</variation> </variation>
<variation key="widthClass=compact"> <variation key="widthClass=compact">
<mask key="subviews"> <mask key="subviews">
<include reference="r0g-Y2-P3v"/>
<include reference="K9J-LG-g2K"/> <include reference="K9J-LG-g2K"/>
<include reference="r0g-Y2-P3v"/>
</mask> </mask>
<mask key="constraints"> <mask key="constraints">
<include reference="Gde-Fa-kB8"/>
<include reference="fNo-Ba-KRO"/> <include reference="fNo-Ba-KRO"/>
<include reference="ieA-8B-e1X"/> <include reference="ieA-8B-e1X"/>
<include reference="xcv-M9-m5f"/> <include reference="xcv-M9-m5f"/>
<include reference="Gde-Fa-kB8"/> <include reference="QYO-fy-GYr"/>
<include reference="AwJ-A8-0MO"/> <include reference="AwJ-A8-0MO"/>
<include reference="V1f-UR-jH8"/>
<include reference="c3k-qN-lYX"/> <include reference="c3k-qN-lYX"/>
<include reference="qvn-rd-wza"/> <include reference="qvn-rd-wza"/>
</mask> </mask>
@ -351,9 +348,9 @@
<include reference="r0g-Y2-P3v"/> <include reference="r0g-Y2-P3v"/>
</mask> </mask>
<mask key="constraints"> <mask key="constraints">
<include reference="wIQ-Lv-buV"/>
<exclude reference="Gde-Fa-kB8"/> <exclude reference="Gde-Fa-kB8"/>
<include reference="j9u-OA-K4W"/> <include reference="j9u-OA-K4W"/>
<include reference="wIQ-Lv-buV"/>
<include reference="6b5-8X-7aD"/> <include reference="6b5-8X-7aD"/>
<include reference="JwF-38-cyF"/> <include reference="JwF-38-cyF"/>
</mask> </mask>

View File

@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="2Bo-lO-qA9"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16C67" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="2Bo-lO-qA9">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies> <dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
<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>
<scenes> <scenes>
@ -18,6 +22,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nWg-4h-oN7" customClass="Logo" customModule="Kiwix" customModuleProvider="target"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nWg-4h-oN7" customClass="Logo" customModule="Kiwix" customModuleProvider="target">
<rect key="frame" x="157.5" y="266.5" width="60" height="60"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="60" id="J1t-fs-gnK"/> <constraint firstAttribute="width" constant="60" id="J1t-fs-gnK"/>
@ -25,6 +30,7 @@
</constraints> </constraints>
</view> </view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HdA-x4-WiZ"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="HdA-x4-WiZ">
<rect key="frame" x="177.5" y="328.5" width="20" height="10"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="10" id="fI2-Co-2QO"/> <constraint firstAttribute="height" constant="10" id="fI2-Co-2QO"/>
@ -32,6 +38,7 @@
</constraints> </constraints>
</view> </view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Wikipedia Anywhere" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="786-cr-yay"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Wikipedia Anywhere" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="786-cr-yay">
<rect key="frame" x="87.5" y="383" width="200" height="21"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="200" id="NIm-me-EN7"/> <constraint firstAttribute="width" constant="200" id="NIm-me-EN7"/>
<constraint firstAttribute="height" constant="21" id="c7K-v2-oGV"/> <constraint firstAttribute="height" constant="21" id="c7K-v2-oGV"/>
@ -47,6 +54,7 @@
</variation> </variation>
</label> </label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="KIWIX" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="heM-Vx-A7u"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="KIWIX" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="heM-Vx-A7u">
<rect key="frame" x="87.5" y="339" width="200" height="36"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="200" id="Zbh-Kq-ZDe"/> <constraint firstAttribute="width" constant="200" id="Zbh-Kq-ZDe"/>
<constraint firstAttribute="height" constant="36" id="md1-oa-sOt"/> <constraint firstAttribute="height" constant="36" id="md1-oa-sOt"/>

View File

@ -83,7 +83,25 @@ class SearchRoundedCornerView: UIView {
break break
} }
} }
}
class TOCRoundedCornerVisualEffectView: UIVisualEffectView {
override func awakeFromNib() {
layer.masksToBounds = true
clipsToBounds = true
}
override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
guard traitCollection != previousTraitCollection else {return}
switch traitCollection.horizontalSizeClass {
case .regular:
layer.cornerRadius = 0.0
case .compact:
layer.cornerRadius = 8.0
default:
break
}
}
} }
class LargeHitZoneImageView: UIImageView { class LargeHitZoneImageView: UIImageView {