質問編集履歴
1
コードを回答返信用に修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -14,27 +14,24 @@
|
|
14
14
|
|
15
15
|
class ViewController: UIViewController {
|
16
16
|
|
17
|
+
|
17
18
|
override func viewDidLayoutSubviews() {
|
18
19
|
super.viewDidLayoutSubviews()
|
19
|
-
|
20
|
-
self.addLine()
|
21
20
|
}
|
21
|
+
}
|
22
22
|
|
23
|
+
|
23
|
-
|
24
|
+
class BaseView:UIView {
|
25
|
+
|
24
|
-
|
26
|
+
override func draw(_ rect: CGRect) {
|
27
|
+
|
25
|
-
|
28
|
+
let path = UIBezierPath()
|
26
|
-
path.move(to: CGPoint(x:
|
29
|
+
path.move(to: CGPoint(x: rect.midX, y: rect.minY))
|
27
|
-
path.addLine(to: CGPoint(x:
|
30
|
+
path.addLine(to: CGPoint(x: rect.midX, y: rect.maxY))
|
28
31
|
path.close()
|
29
32
|
path.lineWidth = 15.0
|
30
33
|
UIColor.red.setStroke()
|
31
34
|
path.stroke()
|
32
|
-
}
|
33
|
-
|
34
|
-
///error: Method does not override any method from its superclass
|
35
|
-
/*override func draw(_ rect: CGRect) {
|
36
|
-
|
37
|
-
self.addLine()
|
38
|
-
}*/
|
39
35
|
}
|
36
|
+
}
|
40
37
|
```
|