-
Notifications
You must be signed in to change notification settings - Fork 0
/
TableViewController.swift
62 lines (44 loc) · 2.03 KB
/
TableViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// TableViewController.swift
// Snake Oil Calculator
//
// Created by Samuel Hazlehurst on 2/9/15.
// Copyright (c) 2015 Terranian Farm. All rights reserved.
//
import UIKit
class TableViewController: UITableViewController {
var calc : CalculatorModel?
@IBOutlet var tView: UITableView!
var items: [String] = ["", "General reccomendations","Nitrogen", "Magnesium"]
override func viewDidLoad() {
super.viewDidLoad()
self.tView.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell")
}
override func viewWillAppear(animated: Bool) {
// Get a reference to the model data from the custom tab bar controller.
calc = (self.tabBarController as! TabBarController).calc
// This tab will simply access the data and display it when the view
// appears.
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.items.count;
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell:UITableViewCell = self.tView.dequeueReusableCellWithIdentifier("cell")! as UITableViewCell
cell.textLabel?.text = self.items[indexPath.row]
return cell
}
// override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
// print("You selected cell #\(indexPath.row)!")
// let calc = (self.tabBarController as! TabBarController!).calc
//
// // calc.requirementLabel = "Pounds Boron Needed:"
// }
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
print("prepareForSegue")
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
}