Edited table view display
This commit is contained in:
@@ -24,6 +24,7 @@ class StopwatchViewController: UIViewController {
|
|||||||
var minutes = 0
|
var minutes = 0
|
||||||
var seconds = 0
|
var seconds = 0
|
||||||
|
|
||||||
|
var lappedTimes: [String] = ["1", "2", "3"]
|
||||||
var timer = Timer()
|
var timer = Timer()
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
@@ -37,12 +38,12 @@ class StopwatchViewController: UIViewController {
|
|||||||
extension StopwatchViewController: UITableViewDelegate, UITableViewDataSource {
|
extension StopwatchViewController: UITableViewDelegate, UITableViewDataSource {
|
||||||
|
|
||||||
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||||
return 100
|
return lappedTimes.count
|
||||||
}
|
}
|
||||||
|
|
||||||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||||
let cell = tableView.dequeueReusableCell(withIdentifier: "lapCell", for: indexPath)
|
let cell = tableView.dequeueReusableCell(withIdentifier: "lapCell", for: indexPath)
|
||||||
cell.textLabel?.text = "I am a lap cell \(indexPath.row + 1)"
|
cell.textLabel?.text = lappedTimes[indexPath.row]
|
||||||
return cell
|
return cell
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user