質問編集履歴
1
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
'
|
test
CHANGED
@@ -1,137 +1,3 @@
|
|
1
1
|
import UIKit
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
class ViewController: UIViewController
|
3
|
+
class ViewController: UIViewController
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
@IBOutlet weak var myLabel: UILabel!
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
override func viewDidLoad() {
|
14
|
-
|
15
|
-
super.viewDidLoad()
|
16
|
-
|
17
|
-
// Do any additional setup after loading the view, typically from a nib.
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
let date = NSDate()
|
22
|
-
|
23
|
-
let format = NSDateFormatter()
|
24
|
-
|
25
|
-
format.dateFormat = "yyyy/MM/dd HH:mm:ss"
|
26
|
-
|
27
|
-
let strDate = format.stringFromDate(date)
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
let nh = strDate.substringWithRange(strDate.startIndex.advancedBy(11)..<strDate.startIndex.advancedBy(13))
|
32
|
-
|
33
|
-
let nm = strDate.substringWithRange(strDate.startIndex.advancedBy(14)..<strDate.startIndex.advancedBy(16))
|
34
|
-
|
35
|
-
let ns = strDate.substringWithRange(strDate.startIndex.advancedBy(17)..<strDate.startIndex.advancedBy(19))
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
let nhms = Int(nh)!*3600 + Int(nm)!*60 + Int(ns)!
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
//時刻表 例 16:28
|
44
|
-
|
45
|
-
let timeTable_h = 16*3600
|
46
|
-
|
47
|
-
let timeTable_m = 28*60
|
48
|
-
|
49
|
-
let timeTable = Int(timeTable_h) + Int(timeTable_m)
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
//時刻表の時間-現在時刻
|
54
|
-
|
55
|
-
let startTime = timeTable - nhms
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
//最初に表示されるスタート時の秒数
|
60
|
-
|
61
|
-
var timerCount = startTime
|
62
|
-
|
63
|
-
var timer = NSTimer()
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
func Counting(){
|
68
|
-
|
69
|
-
timerCount -= 1
|
70
|
-
|
71
|
-
let h = timerCount / 3600
|
72
|
-
|
73
|
-
let m = timerCount / 60 % 60
|
74
|
-
|
75
|
-
let s = timerCount % 60
|
76
|
-
|
77
|
-
myLabel.text = "\(h)時間\(m)分\(s)秒"
|
78
|
-
|
79
|
-
}
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: Selector("Counting"), userInfo: nil, repeats: true)
|
84
|
-
|
85
|
-
}
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
override func didReceiveMemoryWarning() {
|
90
|
-
|
91
|
-
super.didReceiveMemoryWarning()
|
92
|
-
|
93
|
-
// Dispose of any resources that can be recreated.
|
94
|
-
|
95
|
-
}
|
96
|
-
|
97
|
-
}
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
xcode 7.2.1
|
102
|
-
|
103
|
-
時刻表を元に現在時刻との差を1秒毎にカウントダウンしたいです
|
104
|
-
|
105
|
-
Build Succeededと表示はでますが、画面が切り替わり右下エリアに
|
106
|
-
|
107
|
-
libc++abi.dylib: terminating with uncaught exception of type NSException と表示がでました
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
a:普通
|
112
|
-
|
113
|
-
b:準急
|
114
|
-
|
115
|
-
c:特急
|
116
|
-
|
117
|
-
[MON][TUE][WED][THU][FRI]
|
118
|
-
|
119
|
-
5: a30 a45 b59
|
120
|
-
|
121
|
-
6: c05 b15 a25
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
[SAT][SUN][HOL]
|
126
|
-
|
127
|
-
5: b47 a59
|
128
|
-
|
129
|
-
6: b10 b21 a30
|
130
|
-
|
131
|
-
まだ書き方が分かりませんので、16:28を入力しておりますが、この部分も上記の形式で時刻表を並べて、スライドかタップで次の時刻表の時間に移動する仕様にしたいと考えております
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
根本的に考え方が間違っているかもしれませんが、どこを訂正すればよろしいでしょううか?
|
136
|
-
|
137
|
-
宜しくお願い致します。
|