Wrapped view controllers in navigation controllers to add large titles, added "Last updated" string in information view controller

This commit is contained in:
Deniz Duezgoeren
2019-08-03 11:01:56 +02:00
parent 7ba1f17fba
commit 866b886840
9 changed files with 140 additions and 128 deletions
+117 -100
View File
@@ -15,79 +15,48 @@
<objects>
<viewController title="AvH Plan" id="9pv-A4-QxB" customClass="GeneralViewController" customModule="AvH_Plan" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="tsR-hK-woN">
<rect key="frame" x="0.0" y="0.0" width="414" height="813"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<navigationBar contentMode="scaleToFill" layoutMarginsFollowReadableWidth="YES" translucent="NO" translatesAutoresizingMaskIntoConstraints="NO" id="F8V-CQ-shR">
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
<viewLayoutGuide key="safeArea" id="b9C-lJ-bz8"/>
<items>
<navigationItem title="AvH Plan" id="b1q-oE-Z8h">
<barButtonItem key="rightBarButtonItem" title="Customize" id="meV-sG-wBX">
<connections>
<segue destination="8XB-jK-YFD" kind="show" id="UX9-mg-MGy"/>
</connections>
</barButtonItem>
</navigationItem>
</items>
</navigationBar>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="PQr-Ze-W5v" firstAttribute="trailing" secondItem="F8V-CQ-shR" secondAttribute="trailing" id="58X-0J-1sz"/>
<constraint firstItem="F8V-CQ-shR" firstAttribute="top" secondItem="PQr-Ze-W5v" secondAttribute="top" id="DPI-mI-nnU"/>
<constraint firstItem="F8V-CQ-shR" firstAttribute="leading" secondItem="PQr-Ze-W5v" secondAttribute="leading" id="lBn-Fe-c3u"/>
</constraints>
<viewLayoutGuide key="safeArea" id="PQr-Ze-W5v"/>
</view>
<tabBarItem key="tabBarItem" title="Plan" image="ic_writing" selectedImage="ic_writing" id="acW-dT-cKf"/>
<connections>
<outlet property="toolbar" destination="F8V-CQ-shR" id="mIg-ga-x97"/>
</connections>
<navigationItem key="navigationItem" id="Qub-xW-2XJ">
<barButtonItem key="rightBarButtonItem" title="Customize" id="bae-uC-OAx">
<connections>
<segue destination="8XB-jK-YFD" kind="popoverPresentation" popoverAnchorBarButtonItem="bae-uC-OAx" id="0Bb-6a-gkf">
<popoverArrowDirection key="popoverArrowDirection" up="YES" down="YES" left="YES" right="YES"/>
</segue>
</connections>
</barButtonItem>
</navigationItem>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="W5J-7L-Pyd" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="749.27536231884062" y="-320.75892857142856"/>
<point key="canvasLocation" x="1628" y="-790"/>
</scene>
<!--Personal-->
<!--Personal Plan View Controller-->
<scene sceneID="wg7-f3-ORb">
<objects>
<viewController storyboardIdentifier="CustomizationViewController" id="8rJ-Kc-sve" customClass="PersonalPlanViewController" customModule="AvH_Plan" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="QS5-Rx-YEW">
<rect key="frame" x="0.0" y="0.0" width="414" height="813"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<navigationBar contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" translucent="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zYA-MY-Azp">
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
<viewLayoutGuide key="safeArea" id="Or0-Ph-ylC"/>
<items>
<navigationItem title="Personal Plan" id="8j4-CR-EDO">
<barButtonItem key="rightBarButtonItem" title="Customize" id="iH8-LX-SKF">
<connections>
<action selector="navBarButton:" destination="8rJ-Kc-sve" id="FA8-tv-rLI"/>
<segue destination="8XB-jK-YFD" kind="show" id="HR4-ZO-fnF"/>
</connections>
</barButtonItem>
</navigationItem>
</items>
</navigationBar>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="zYA-MY-Azp" firstAttribute="trailing" secondItem="O1u-W8-tvY" secondAttribute="trailing" id="AhQ-VX-SQ8"/>
<constraint firstItem="zYA-MY-Azp" firstAttribute="top" secondItem="O1u-W8-tvY" secondAttribute="top" id="h9U-jR-HuZ"/>
<constraint firstItem="zYA-MY-Azp" firstAttribute="leading" secondItem="O1u-W8-tvY" secondAttribute="leading" id="odb-l1-x2e"/>
</constraints>
<viewLayoutGuide key="safeArea" id="O1u-W8-tvY"/>
</view>
<tabBarItem key="tabBarItem" title="Personal" image="ic_idea" selectedImage="ic_idea" id="cPa-gy-q4n"/>
<connections>
<outlet property="toolbar" destination="zYA-MY-Azp" id="Czs-9C-hJ2"/>
</connections>
<navigationItem key="navigationItem" id="T1a-Dc-Mt0">
<barButtonItem key="rightBarButtonItem" title="Customize" id="zsF-Jh-U3n">
<connections>
<segue destination="8XB-jK-YFD" kind="popoverPresentation" popoverAnchorBarButtonItem="zsF-Jh-U3n" id="OZ6-ZZ-xdo">
<popoverArrowDirection key="popoverArrowDirection" up="YES" down="YES" left="YES" right="YES"/>
</segue>
</connections>
</barButtonItem>
</navigationItem>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="4Nw-L8-lE0" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1489.8550724637682" y="-321.42857142857139"/>
<point key="canvasLocation" x="1628" y="-112"/>
</scene>
<!--Customization View Controller-->
<scene sceneID="gAv-U3-QPB">
@@ -194,7 +163,6 @@
<connections>
<outlet property="collectionView" destination="hWP-3N-RUn" id="RFo-DP-uPX"/>
<outlet property="defaultSegments" destination="omP-RH-Hlh" id="hVo-ND-9EG"/>
<outlet property="toolbar" destination="1XB-6S-dGV" id="1Yf-SM-ANg"/>
<outlet property="txtClasses" destination="bCV-w1-hVY" id="lDD-NQ-f8f"/>
<outlet property="txtCourses" destination="69O-Fo-TQF" id="AC7-pO-Jms"/>
<outlet property="txtName" destination="TpM-Mz-EpI" id="W0o-NR-E96"/>
@@ -202,7 +170,7 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="fIE-1y-qpc" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2524.6376811594205" y="-348.21428571428572"/>
<point key="canvasLocation" x="2691" y="-514"/>
</scene>
<!--Colour Picker View-->
<scene sceneID="H2r-WV-fSr">
@@ -259,25 +227,18 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="hiX-3i-iLz" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3363.7681159420295" y="-341.51785714285711"/>
<point key="canvasLocation" x="3503" y="-514"/>
</scene>
<!--Information-->
<!--Info View Controller-->
<scene sceneID="tt5-VM-aeV">
<objects>
<viewController id="Ve9-lV-ekU" customClass="InfoViewController" customModule="AvH_Plan" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="eFO-Bf-72I">
<rect key="frame" x="0.0" y="0.0" width="414" height="813"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<navigationBar contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" translucent="NO" translatesAutoresizingMaskIntoConstraints="NO" id="n9O-m5-UQM">
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
<viewLayoutGuide key="safeArea" id="YA8-Ln-bdM"/>
<items>
<navigationItem title="Information" id="9lv-eD-jS6"/>
</items>
</navigationBar>
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" showsHorizontalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="uw2-gR-W7a">
<rect key="frame" x="0.0" y="88" width="414" height="725"/>
<rect key="frame" x="0.0" y="140" width="414" height="673"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3fL-cf-hwr">
<rect key="frame" x="0.0" y="0.0" width="414" height="52.333333333333336"/>
@@ -309,17 +270,14 @@
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="n9O-m5-UQM" firstAttribute="leading" secondItem="eFO-Bf-72I" secondAttribute="leading" id="1Wa-Qr-Bhb"/>
<constraint firstItem="fuI-1W-d0u" firstAttribute="trailing" secondItem="n9O-m5-UQM" secondAttribute="trailing" id="Itb-7h-ird"/>
<constraint firstItem="uw2-gR-W7a" firstAttribute="leading" secondItem="fuI-1W-d0u" secondAttribute="leading" id="SHL-lX-cF5"/>
<constraint firstItem="fuI-1W-d0u" firstAttribute="trailing" secondItem="uw2-gR-W7a" secondAttribute="trailing" id="Ypb-ba-cQV"/>
<constraint firstItem="n9O-m5-UQM" firstAttribute="top" secondItem="fuI-1W-d0u" secondAttribute="top" id="ccZ-hZ-aNP"/>
<constraint firstItem="uw2-gR-W7a" firstAttribute="top" secondItem="n9O-m5-UQM" secondAttribute="bottom" id="dEI-0y-6Nj"/>
<constraint firstItem="uw2-gR-W7a" firstAttribute="top" secondItem="fuI-1W-d0u" secondAttribute="top" id="hcg-67-avl"/>
<constraint firstItem="fuI-1W-d0u" firstAttribute="bottom" secondItem="uw2-gR-W7a" secondAttribute="bottom" id="uXS-YK-oIz"/>
</constraints>
<viewLayoutGuide key="safeArea" id="fuI-1W-d0u"/>
</view>
<tabBarItem key="tabBarItem" title="Information" image="ic_information" selectedImage="ic_information" id="BQ7-VO-yI4"/>
<navigationItem key="navigationItem" id="ZSj-6h-iwN"/>
<connections>
<outlet property="content" destination="6H8-lj-boN" id="Q49-OJ-zsl"/>
<outlet property="scrollView" destination="uw2-gR-W7a" id="C2y-Jf-fgR"/>
@@ -327,60 +285,119 @@
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="JwL-CA-SQG" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="749" y="342"/>
<point key="canvasLocation" x="1631.8840579710147" y="572.54464285714278"/>
</scene>
<!--Menu-->
<!--Menu View Controller-->
<scene sceneID="JTo-oO-5Xc">
<objects>
<viewController id="bBH-of-tdd" customClass="MenuViewController" customModule="AvH_Plan" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="nOs-f2-7qu">
<rect key="frame" x="0.0" y="0.0" width="414" height="813"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<navigationBar contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" layoutMarginsFollowReadableWidth="YES" translucent="NO" translatesAutoresizingMaskIntoConstraints="NO" id="R10-r1-giF">
<rect key="frame" x="0.0" y="44" width="414" height="44"/>
<viewLayoutGuide key="safeArea" id="zEW-od-JDN"/>
<items>
<navigationItem title="Food Menu" id="mFX-6q-tAs"/>
</items>
</navigationBar>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="2XG-5F-awv" firstAttribute="trailing" secondItem="R10-r1-giF" secondAttribute="trailing" id="2ph-BT-xaa"/>
<constraint firstItem="R10-r1-giF" firstAttribute="top" secondItem="2XG-5F-awv" secondAttribute="top" id="MXM-m5-w5i"/>
<constraint firstItem="R10-r1-giF" firstAttribute="leading" secondItem="nOs-f2-7qu" secondAttribute="leading" id="hI9-lC-axL"/>
</constraints>
<viewLayoutGuide key="safeArea" id="2XG-5F-awv"/>
</view>
<tabBarItem key="tabBarItem" title="Menu" image="ic_tomato" selectedImage="ic_tomato" id="IfX-2p-YWq"/>
<connections>
<outlet property="toolbar" destination="R10-r1-giF" id="t9w-Yn-Waj"/>
</connections>
<navigationItem key="navigationItem" id="dT4-da-Exr"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="8Cd-nN-1G8" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1485.5072463768117" y="346.875"/>
<point key="canvasLocation" x="1632" y="1246"/>
</scene>
<!--AvH Plan-->
<scene sceneID="yl2-sM-qoP">
<objects>
<tabBarController title="AvH Plan" id="49e-Tb-3d3" customClass="CustomTabBarController" customModule="AvH_Plan" customModuleProvider="target" sceneMemberID="viewController">
<tabBar key="tabBar" contentMode="scaleToFill" translucent="NO" id="W28-zg-YXA">
<tabBar key="tabBar" contentMode="scaleToFill" id="W28-zg-YXA">
<rect key="frame" x="0.0" y="975" width="768" height="49"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
</tabBar>
<connections>
<segue destination="9pv-A4-QxB" kind="relationship" relationship="viewControllers" id="u7Y-xg-7CH"/>
<segue destination="8rJ-Kc-sve" kind="relationship" relationship="viewControllers" id="lzU-1b-eKA"/>
<segue destination="Ve9-lV-ekU" kind="relationship" relationship="viewControllers" id="Vg0-hd-66G"/>
<segue destination="bBH-of-tdd" kind="relationship" relationship="viewControllers" id="L24-WL-MU3"/>
<segue destination="u5k-1S-jRe" kind="relationship" relationship="viewControllers" id="u7Y-xg-7CH"/>
<segue destination="ceg-T8-6Bs" kind="relationship" relationship="viewControllers" id="lzU-1b-eKA"/>
<segue destination="QLo-hR-KTA" kind="relationship" relationship="viewControllers" id="Vg0-hd-66G"/>
<segue destination="TgU-Wp-q74" kind="relationship" relationship="viewControllers" id="L24-WL-MU3"/>
</connections>
</tabBarController>
<placeholder placeholderIdentifier="IBFirstResponder" id="HuB-VB-40B" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="0.0" y="0.0"/>
</scene>
<!--Plan-->
<scene sceneID="wZh-Nl-baJ">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="u5k-1S-jRe" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Plan" image="ic_writing" selectedImage="ic_writing" id="acW-dT-cKf"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" largeTitles="YES" id="eWV-1q-K0n">
<rect key="frame" x="0.0" y="44" width="414" height="96"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="9pv-A4-QxB" kind="relationship" relationship="rootViewController" id="Sgi-MO-0hJ"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="PN8-Zl-JEK" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="797" y="-800"/>
</scene>
<!--Personal-->
<scene sceneID="D1i-4D-DF5">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="ceg-T8-6Bs" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Personal" image="ic_idea" selectedImage="ic_idea" id="cPa-gy-q4n"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" largeTitles="YES" id="uhu-Jz-N3s">
<rect key="frame" x="0.0" y="44" width="414" height="96"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="8rJ-Kc-sve" kind="relationship" relationship="rootViewController" id="OeD-X8-ac2"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="na2-df-29J" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="748" y="-120"/>
</scene>
<!--Information-->
<scene sceneID="8Mm-U7-JgF">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="QLo-hR-KTA" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Information" image="ic_information" selectedImage="ic_information" id="BQ7-VO-yI4"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" largeTitles="YES" id="7nl-mF-KID">
<rect key="frame" x="0.0" y="44" width="414" height="96"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="Ve9-lV-ekU" kind="relationship" relationship="rootViewController" id="CgO-X2-kmQ"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="IMM-XL-aYt" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="721.73913043478262" y="572.54464285714278"/>
</scene>
<!--Menu-->
<scene sceneID="wy5-3k-0tO">
<objects>
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="TgU-Wp-q74" sceneMemberID="viewController">
<tabBarItem key="tabBarItem" title="Menu" image="ic_tomato" selectedImage="ic_tomato" id="IfX-2p-YWq"/>
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" largeTitles="YES" id="X3a-nR-zZn">
<rect key="frame" x="0.0" y="44" width="414" height="96"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="bBH-of-tdd" kind="relationship" relationship="rootViewController" id="Poe-ld-Xi5"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="mlr-hH-QPP" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="704" y="1221"/>
</scene>
</scenes>
<resources>
<image name="ic_idea" width="16.666666030883789" height="25"/>
@@ -389,6 +406,6 @@
<image name="ic_writing" width="25" height="25"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="UX9-mg-MGy"/>
<segue reference="OZ6-ZZ-xdo"/>
</inferredMetricsTieBreakers>
</document>
@@ -24,8 +24,6 @@ class CustomizationViewController: UIViewController, UICollectionViewDataSource,
@IBOutlet weak var txtCourses: UITextField!
@IBOutlet weak var defaultSegments: UISegmentedControl!
@IBOutlet weak var toolbar: UINavigationBar!
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
courses = self.df.courses
+4 -6
View File
@@ -35,7 +35,7 @@ class DataFetcher {
func doAsync(do task: String, completionHandler: @escaping (_ substitutions: [Any]) -> ()) {
DispatchQueue(label: "work-queue").async {
let foodUrl = "https://djd4rkn355.github.io/food.html"
let url = "https://djd4rkn355.github.io/subst.html"
let url = "https://djd4rkn355.github.io/subst_test.html"
Alamofire.request(url).responseString { response in
if let html = response.result.value {
Alamofire.request(foodUrl).responseString { response in
@@ -139,14 +139,12 @@ class DataFetcher {
_ = try db.run(insertPersonal)
}
let lastUpdated = try doc.select("h1").get(0).text()
info = "\(NSLocalizedString("last_updated", comment: ""))\(lastUpdated)."
let pi: Elements = try doc.select("p")
for item in pi {
if info.isEmpty {
info = try item.text()
} else {
info += "\n\n\(try item.text())"
}
info += "\n\n\(try item.text())"
}
_ = prefs.set(info, forKey: "information")
+1 -6
View File
@@ -9,11 +9,10 @@
import UIKit
class GeneralViewController: PlanViewController {
@IBOutlet weak var toolbar: UINavigationBar!
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.navigationBar.topItem?.title = NSLocalizedString("avh_plan", comment: "")
}
override func getViewType() -> String {
@@ -27,10 +26,6 @@ class GeneralViewController: PlanViewController {
override func getFromDatabase() -> [SubstModel] {
return df.getFromDatabase()
}
override func getToolbarBottomAnchor() -> NSLayoutYAxisAnchor {
return toolbar.bottomAnchor
}
/*
// MARK: - Navigation
+5
View File
@@ -30,6 +30,11 @@ class InfoViewController : UIViewController {
content.text = df.readInformation()
}
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.navigationBar.topItem?.title = NSLocalizedString("information", comment: "")
}
@objc private func objDoAsync(_ sender: Any) {
self.df.doAsync(do: "info") { infoArray in
self.content.text = infoArray[0] as? String
+6 -6
View File
@@ -14,7 +14,6 @@ class MenuViewController : UIViewController, UICollectionViewDataSource, UIColle
var items = [String]()
private let refreshControl = UIRefreshControl()
let df = DataFetcher.sharedInstance
@IBOutlet weak var toolbar: UINavigationBar!
let layout = MagazineLayout()
var collectionView: UICollectionView
let identifier = "menu_cell"
@@ -32,7 +31,7 @@ class MenuViewController : UIViewController, UICollectionViewDataSource, UIColle
NSLayoutConstraint.activate([
collectionView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
collectionView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
collectionView.topAnchor.constraint(equalTo: self.toolbar.bottomAnchor),
collectionView.topAnchor.constraint(equalTo: view.topAnchor),
collectionView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
])
collectionView.register(UINib(nibName: "MenuViewCell", bundle: nil), forCellWithReuseIdentifier: identifier)
@@ -53,6 +52,11 @@ class MenuViewController : UIViewController, UICollectionViewDataSource, UIColle
self.collectionView.reloadData()
}
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.navigationBar.topItem?.title = NSLocalizedString("food_menu", comment: "")
}
@objc private func objDoAsync(_ sender: Any) {
df.doAsync(do: "menu") { menuItems in
self.items = menuItems as! [String]
@@ -74,10 +78,6 @@ class MenuViewController : UIViewController, UICollectionViewDataSource, UIColle
cell.backgroundColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
print("You selected cell#\(indexPath.item)!")
}
// generated stubs filled with return values
+2 -7
View File
@@ -10,7 +10,6 @@ import UIKit
class PersonalPlanViewController: PlanViewController {
@IBOutlet weak var toolbar: UINavigationBar!
let prefs = UserDefaults.standard
@IBAction func toolbarButtonCustomise(_ sender: UIBarButtonItem) {
@@ -44,9 +43,9 @@ class PersonalPlanViewController: PlanViewController {
let user = self.prefs.string(forKey: "username")
if (user != nil && user != "") {
if (user!.last == "x" || user!.last == "s" || user!.last == "z") {
self.toolbar!.topItem!.title = "\(user!)\(NSLocalizedString("nosplan", comment: ""))"
self.navigationController?.navigationBar.topItem?.title = "\(user!)\(NSLocalizedString("nosplan", comment: ""))"
} else {
self.toolbar!.topItem!.title = "\(user!)\(NSLocalizedString("splan", comment: ""))"
self.navigationController?.navigationBar.topItem?.title = "\(user!)\(NSLocalizedString("splan", comment: ""))"
}
}
}
@@ -62,9 +61,5 @@ class PersonalPlanViewController: PlanViewController {
override func getFromDatabase() -> [SubstModel] {
return df.getPersonalFromDatabase()
}
override func getToolbarBottomAnchor() -> NSLayoutYAxisAnchor {
return toolbar.bottomAnchor
}
}
+1 -1
View File
@@ -35,7 +35,7 @@ class PlanViewController : UIViewController, UICollectionViewDataSource, UIColle
NSLayoutConstraint.activate([
collectionView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
collectionView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
collectionView.topAnchor.constraint(equalTo: getToolbarBottomAnchor()),
collectionView.topAnchor.constraint(equalTo: view.topAnchor), // getToolbarBottomAnchor()),
collectionView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
])
collectionView.register(UINib(nibName: "PlanViewCell", bundle: nil), forCellWithReuseIdentifier: identifier)
+4
View File
@@ -78,3 +78,7 @@
/* Class = "UILabel"; text = "Custom colours"; ObjectID = "rks-gf-AM4"; */
"rks-gf-AM4.text" = "Benutzerdefinierte Farben";
"bae-uC-OAx.text" = "Anpassen";
"zsF-Jh-U3n.text" = "Anpassen";