質問編集履歴
2
発生している問題を訂正
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,11 +6,52 @@
|
|
6
6
|
###発生している問題・エラーメッセージ
|
7
7
|
|
8
8
|
```
|
9
|
-
|
9
|
+
import UIKit
|
10
10
|
|
11
|
+
class ViewController: UIViewController {
|
12
|
+
|
13
|
+
@IBOutlet var yearLabel:UILabel!
|
14
|
+
@IBOutlet var monthLabel:UILabel!
|
15
|
+
@IBOutlet var dayLabel:UILabel!
|
16
|
+
|
17
|
+
var dayCount = 0;
|
18
|
+
|
19
|
+
override func viewDidLoad() {
|
20
|
+
super.viewDidLoad()
|
21
|
+
// Do any additional setup after loading the view, typically from a nib.
|
22
|
+
|
23
|
+
showDate()
|
24
|
+
}
|
25
|
+
|
26
|
+
func showDate(){
|
27
|
+
let seconds = TimeInterval(dayCount*24*60*60)
|
28
|
+
let now = NSDate(timeIntervalSinceNow:seconds)
|
29
|
+
|
30
|
+
let dateFormatter = DateFormatter()
|
31
|
+
dateFormatter.locale = NSLocale(localeIdentifier:"ja_JP") as Locale!
|
32
|
+
|
33
|
+
dateFormatter.dateFormat = "yyyy"
|
34
|
+
let year = dateFormatter.string(from: now as Date)
|
35
|
+
yearLabel.text = year
|
36
|
+
|
37
|
+
dateFormatter.dateFormat = "M"
|
38
|
+
let month = dateFormatter.string(from: now as Date)
|
39
|
+
monthLabel.text = month
|
40
|
+
|
41
|
+
dateFormatter.dateFormat = "d"
|
42
|
+
let day = dateFormatter.string(from: now as Date)
|
43
|
+
dayLabel.text = day
|
44
|
+
}
|
45
|
+
|
46
|
+
override func didReceiveMemoryWarning() {
|
47
|
+
super.didReceiveMemoryWarning()
|
11
|
-
|
48
|
+
// Dispose of any resources that can be recreated.
|
49
|
+
}
|
50
|
+
|
51
|
+
|
52
|
+
}
|
12
53
|
```
|
13
|
-
|
54
|
+
このように書き換えたのですが、シュミレーターを起動させても動作せずに困っています。
|
14
55
|
|
15
56
|
###該当のソースコード
|
16
57
|
```Swift
|
1
タイトルを編集
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
swiftのコードのエラーをどのように直せばいいか
|
1
|
+
swiftの今日の日付を取ってくるコードのエラーをどのように直せばいいか
|
body
CHANGED
File without changes
|