-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathletsTryTableViewController.swift
61 lines (46 loc) · 1.8 KB
/
letsTryTableViewController.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
//
// letsTryTableViewController.swift
// meetTheTeam
//
// Created by Taylor Simpson on 5/10/17.
// Copyright © 2017 Taylor Simpson. All rights reserved.
//
import UIKit
class letsTryTableViewController: UITableViewController {
var firstPoint: CGPoint?
var secondPoint: CGPoint?
override func viewDidLoad() {
super.viewDidLoad()
firstPoint = CGPoint(x: 0.0, y: 250.0)
secondPoint = CGPoint(x: 500, y: 323)
addLine(fromPoint: firstPoint! , toPoint: secondPoint!)
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// MARK: - Table view data source
override func numberOfSections(in tableView: UITableView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 0
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of rows
return 1
}
func addLine(fromPoint start: CGPoint, toPoint end:CGPoint) {
let line = CAShapeLayer()
let linePath = UIBezierPath()
linePath.move(to: start)
linePath.addLine(to: end)
line.path = linePath.cgPath
line.strokeColor = UIColor.red.cgColor
line.lineWidth = 10
line.lineJoin = kCALineJoinRound
self.view.layer.addSublayer(line)
}
}