質問編集履歴
1
載せるプログラムを増やした
test
CHANGED
File without changes
|
test
CHANGED
@@ -7,6 +7,24 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
```Swift
|
10
|
+
|
11
|
+
class ViewControllerSetting: UIViewController {
|
12
|
+
|
13
|
+
var TimerSet2:CGFloat = 0
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
override func viewDidLoad() {
|
18
|
+
|
19
|
+
super.viewDidLoad()
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
// Do any additional setup after loading the view.
|
24
|
+
|
25
|
+
}
|
26
|
+
|
27
|
+
|
10
28
|
|
11
29
|
@IBAction func Button1000(_ sender: Any) {
|
12
30
|
|
@@ -38,11 +56,39 @@
|
|
38
56
|
|
39
57
|
```Swift
|
40
58
|
|
41
|
-
pr
|
59
|
+
import UIKit
|
60
|
+
|
61
|
+
//extension UIImage {
|
42
62
|
|
43
63
|
|
44
64
|
|
65
|
+
class ViewControllergame: UIViewController {
|
66
|
+
|
67
|
+
@IBOutlet weak var TimerSecond: UIImageView!
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
var TimerTimer:Timer!
|
72
|
+
|
73
|
+
var TimerAngle:CGFloat = 0
|
74
|
+
|
75
|
+
var TimerSet:CGFloat = 0
|
76
|
+
|
77
|
+
//ここで、タイマーの時間を設定
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
override func viewDidLoad() {
|
82
|
+
|
83
|
+
super.viewDidLoad()
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
print(TimerSet)
|
88
|
+
|
89
|
+
//タイマーのプログラム
|
90
|
+
|
45
|
-
TimerTimer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true, block:{ (t) in
|
91
|
+
TimerTimer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true, block:{ (t) in
|
46
92
|
|
47
93
|
self.TimerAngle = self.TimerAngle + 1
|
48
94
|
|
@@ -57,40 +103,6 @@
|
|
57
103
|
}
|
58
104
|
|
59
105
|
})
|
60
|
-
|
61
|
-
```
|
62
|
-
|
63
|
-
このプログラムで実行すると、printで変数TimerSetの中身は0.0と表示されてしまいます...
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
#試したこと
|
68
|
-
|
69
|
-
ボタンのプログラムを
|
70
|
-
|
71
|
-
```Swift
|
72
|
-
|
73
|
-
@IBAction func Button1000(_ sender: Any) {
|
74
|
-
|
75
|
-
performSegue(withIdentifier:"VCGame", sender: nil)
|
76
|
-
|
77
|
-
TimerSet2 = 1000
|
78
|
-
|
79
|
-
print("1000")
|
80
|
-
|
81
|
-
func prepare(for segue:UIStoryboardSegue, sender: Any? ) {
|
82
|
-
|
83
|
-
if segue.identifier == "VCGame" {
|
84
|
-
|
85
|
-
let vcGame = segue.destination as!ViewControllergame
|
86
|
-
|
87
|
-
vcGame.TimerSet = TimerSet2
|
88
|
-
|
89
|
-
}
|
90
|
-
|
91
|
-
}
|
92
|
-
|
93
|
-
}
|
94
106
|
|
95
107
|
```
|
96
108
|
|