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
+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