質問編集履歴

4

変更

2018/04/20 03:53

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -263,3 +263,13 @@
263
263
 
264
264
 
265
265
  ```
266
+
267
+
268
+
269
+ //
270
+
271
+
272
+
273
+ 画像を追加しました。
274
+
275
+ ![イメージ説明](892a1dffa0dcf255ac1c8e68dc87d4c5.png)

3

変更

2018/04/20 03:53

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -214,7 +214,7 @@
214
214
 
215
215
 
216
216
 
217
- //ホリゾンタルにしたいCCCCellです。
217
+ //ホリゾンタルにしたいグレーのCCCCellです。
218
218
 
219
219
 
220
220
 

2

変更

2018/04/19 12:31

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -21,3 +21,245 @@
21
21
  教えて頂ければ助かります。
22
22
 
23
23
  よろしくお願いします。
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+ 追記しました。
32
+
33
+
34
+
35
+ ```ここに言語を入力
36
+
37
+
38
+
39
+ //コントローラーです
40
+
41
+
42
+
43
+ import UIKit
44
+
45
+
46
+
47
+
48
+
49
+ class HogeController: UICollectionViewController, UICollectionViewDelegateFlowLayout {
50
+
51
+
52
+
53
+ let cellId3 = "cellId"
54
+
55
+ let cellId2 = "cellId"
56
+
57
+ let cellId = "cellId"
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+ override func viewDidLoad() {
68
+
69
+ super.viewDidLoad()
70
+
71
+
72
+
73
+ collectionView?.backgroundColor = .white
74
+
75
+ let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
76
+
77
+ layout.minimumLineSpacing = 0
78
+
79
+ layout.minimumInteritemSpacing = 0
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+ collectionView?.register(CCCCell.self, forCellWithReuseIdentifier: "cellId3")
88
+
89
+ collectionView?.register(BBBCell.self, forCellWithReuseIdentifier: "cellId2")
90
+
91
+ collectionView?.register(AAACell.self,forCellWithReuseIdentifier: "cellId")
92
+
93
+ }
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+ override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
106
+
107
+
108
+
109
+ switch indexPath.section {
110
+
111
+ case 2:
112
+
113
+ return collectionView.dequeueReusableCell(withReuseIdentifier: "cellId3", for: indexPath) as! CCCCell
114
+
115
+ case 1:
116
+
117
+ return collectionView.dequeueReusableCell(withReuseIdentifier: "cellId2", for: indexPath) as! BBBCell
118
+
119
+ default:
120
+
121
+ return collectionView.dequeueReusableCell(withReuseIdentifier: "cellId", for: indexPath) as! AAACell
122
+
123
+ }
124
+
125
+ }
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+ override func numberOfSections(in collectionView: UICollectionView) -> Int {
136
+
137
+ return 3
138
+
139
+
140
+
141
+ }
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+ override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
150
+
151
+
152
+
153
+ if section == 2 {
154
+
155
+ return 10
156
+
157
+ }
158
+
159
+ else {
160
+
161
+ return 1
162
+
163
+ }
164
+
165
+ }
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+ func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
176
+
177
+
178
+
179
+ switch indexPath.section {
180
+
181
+ case 2:
182
+
183
+ return CGSize(width: 50, height: 50)
184
+
185
+ case 1:
186
+
187
+ return CGSize(width: view.frame.width, height: 200)
188
+
189
+ default:
190
+
191
+ return CGSize(width: view.frame.width, height: 200)
192
+
193
+ }
194
+
195
+ }
196
+
197
+
198
+
199
+
200
+
201
+ }
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+ ```
210
+
211
+
212
+
213
+ ```ここに言語を入力
214
+
215
+
216
+
217
+ //ホリゾンタルにしたいCCCCellです。
218
+
219
+
220
+
221
+ import UIKit
222
+
223
+
224
+
225
+ class CCCCell: UICollectionViewCell {
226
+
227
+ override init(frame: CGRect) {
228
+
229
+ super.init(frame: frame)
230
+
231
+ setupMenuBar()
232
+
233
+ backgroundColor = .gray
234
+
235
+
236
+
237
+ }
238
+
239
+
240
+
241
+ required init?(coder aDecoder: NSCoder) {
242
+
243
+ fatalError("init(coder:) has not been implemented")
244
+
245
+ }
246
+
247
+
248
+
249
+ private func setupMenuBar() {
250
+
251
+
252
+
253
+ }
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+ }
262
+
263
+
264
+
265
+ ```

1

変更

2018/04/19 12:24

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
File without changes