-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCheckoutTableViewController.swift
75 lines (50 loc) · 2.01 KB
/
CheckoutTableViewController.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
63
//
// CheckoutTableViewController.swift
// Ecommerce
//
// Created by Eric Rosas on 2/13/17.
// Copyright © 2017 EmpireAppDesignz. All rights reserved.
//
import UIKit
class CheckoutTableViewController: UITableViewController
{
struct Storyboard {
static let billingTitleCell = "billingTitleCell" // cell 0
static let billingInfoCell = "billingInfoCell" // cell 1
static let cartDetailCell = "cartDetailCell" // cell 2
static let cartTotalCell = "cartTotalCell" // cell 3
static let submitButtonCell = "submitButtonCell" // cell 4
}
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.estimatedRowHeight = tableView.rowHeight
tableView.rowHeight = UITableView.automaticDimension
}
}
extension CheckoutTableViewController
{
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 5
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
switch indexPath.row {
case 0:
let cell = tableView.dequeueReusableCell(withIdentifier: Storyboard.billingTitleCell, for: indexPath)
return cell
case 1:
let cell = tableView.dequeueReusableCell(withIdentifier: Storyboard.billingInfoCell, for: indexPath)
return cell
case 2:
let cell = tableView.dequeueReusableCell(withIdentifier: Storyboard.cartDetailCell, for: indexPath)
return cell
case 3:
let cell = tableView.dequeueReusableCell(withIdentifier: Storyboard.cartTotalCell, for: indexPath)
return cell
case 4:
let cell = tableView.dequeueReusableCell(withIdentifier: Storyboard.submitButtonCell, for: indexPath)
return cell
default: return UITableViewCell()
}
}
}