-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewController.swift
More file actions
55 lines (45 loc) · 1.55 KB
/
ViewController.swift
File metadata and controls
55 lines (45 loc) · 1.55 KB
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
//
// ViewController.swift
// planner
//
// Created by 김영훈 on 2024/04/04.
//
import UIKit
class PlannerCell: SwipableTableViewCell {
public required init?(coder: NSCoder) {
super.init(coder: coder)
tintColor = .purple
let button1 = UIButton(frame: CGRect(origin: .zero, size: CGSize(width: 50, height: 50)))
button1.backgroundColor = .red
button1.setImage(UIImage(systemName: "trash"), for: .normal)
button1.tintColor = .white
add(button: button1, to: .trailing)
let button2 = UIButton(frame: CGRect(origin: .zero, size: CGSize(width: 50, height: 50)))
button2.backgroundColor = .yellow
button2.setImage(UIImage(systemName: "star"), for: .normal)
button2.tintColor = .black
add(button: button2, to: .leading)
}
}
class ViewController: UIViewController {
@IBOutlet weak var tableView: SwipableTableView! {
didSet {
tableView.delegate = self
tableView.dataSource = self
}
}
override func viewDidLoad() {
super.viewDidLoad()
}
}
extension ViewController: UITableViewDelegate {
}
extension ViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! PlannerCell
return cell
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 10
}
}