回答編集履歴

3

s

2018/06/14 11:13

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -1,24 +1,32 @@
1
- セルなんですね、勘違い。
1
+ 以下の様にしてみてください。
2
2
 
3
3
 
4
4
 
5
5
  ```swift
6
6
 
7
- let textLabel = UILabel(frame: CGRect(x: 0,y: 0, width: self.frame.width, height: self.frame.height))
7
+ class CalendarCell: UICollectionViewCell {
8
8
 
9
- ```
9
+
10
10
 
11
+ var textLabel: UILabel!
11
12
 
13
+
12
14
 
13
- 上記のコードはサンプルのコードをそのまま置き換えただけですが、????のコードで同じ処理になります。
15
+ required init?(coder aDecoder: NSCoder) {
14
16
 
17
+ super.init(coder: aDecoder)!
15
18
 
19
+
16
20
 
21
+ textLabel = UILabel(frame: CGRect(x: 0, y: 0, width: self.frame.width, height: self.frame.height))
17
22
 
23
+ textLabel.font = UIFont(name: "HirakakuPro-W3", size: 12)
18
24
 
19
- ```swift
25
+ textLabel.textAlignment = .center
20
26
 
21
- let textLabel = UILabel(frame: self.bounds)
27
+ }
28
+
29
+ }
22
30
 
23
31
  ```
24
32
 

2

s

2018/06/14 11:13

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -1,6 +1,10 @@
1
+ セルなんですね、勘違い。
2
+
3
+
4
+
1
5
  ```swift
2
6
 
3
- let textLabel = UILabel(frame: CGRect(x: 0,y: 0, width: self.view.frame.width, height: self.view.frame.height))
7
+ let textLabel = UILabel(frame: CGRect(x: 0,y: 0, width: self.frame.width, height: self.frame.height))
4
8
 
5
9
  ```
6
10
 
@@ -14,7 +18,7 @@
14
18
 
15
19
  ```swift
16
20
 
17
- let textLabel = UILabel(frame: view.bounds)
21
+ let textLabel = UILabel(frame: self.bounds)
18
22
 
19
23
  ```
20
24
 

1

s

2018/06/14 10:50

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -7,8 +7,6 @@
7
7
 
8
8
 
9
9
  上記のコードはサンプルのコードをそのまま置き換えただけですが、????のコードで同じ処理になります。
10
-
11
- 参考URL:
12
10
 
13
11
 
14
12