質問編集履歴
2
peopleColorのprint出力内容と、peopleListCellのソースコードを記載
test
CHANGED
File without changes
|
test
CHANGED
@@ -141,3 +141,247 @@
|
|
141
141
|
}
|
142
142
|
|
143
143
|
```
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
### print(self.peopleColor[indexPath.row])の中身
|
148
|
+
|
149
|
+
初期画面での出力内容を①
|
150
|
+
|
151
|
+
そこから少しスクロールした状態での出力内容を②
|
152
|
+
|
153
|
+
最後までスクロールした状態での出力内容を③
|
154
|
+
|
155
|
+
として記載しています。
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
```
|
160
|
+
|
161
|
+
red
|
162
|
+
|
163
|
+
red
|
164
|
+
|
165
|
+
red
|
166
|
+
|
167
|
+
red
|
168
|
+
|
169
|
+
red →少しスクロールすると、ここから先が繰り返される
|
170
|
+
|
171
|
+
blue
|
172
|
+
|
173
|
+
blue
|
174
|
+
|
175
|
+
red
|
176
|
+
|
177
|
+
blue
|
178
|
+
|
179
|
+
red
|
180
|
+
|
181
|
+
red
|
182
|
+
|
183
|
+
yellow
|
184
|
+
|
185
|
+
blue
|
186
|
+
|
187
|
+
yellow
|
188
|
+
|
189
|
+
———————↑①ここまでが、初期画面状態でのprint
|
190
|
+
|
191
|
+
red
|
192
|
+
|
193
|
+
blue
|
194
|
+
|
195
|
+
blue
|
196
|
+
|
197
|
+
red
|
198
|
+
|
199
|
+
blue
|
200
|
+
|
201
|
+
red
|
202
|
+
|
203
|
+
red
|
204
|
+
|
205
|
+
yellow
|
206
|
+
|
207
|
+
blue
|
208
|
+
|
209
|
+
yellow
|
210
|
+
|
211
|
+
———————↑②少しスクロールすると、ここまで表示される
|
212
|
+
|
213
|
+
yellow
|
214
|
+
|
215
|
+
blue
|
216
|
+
|
217
|
+
yellow
|
218
|
+
|
219
|
+
red
|
220
|
+
|
221
|
+
red
|
222
|
+
|
223
|
+
yellow
|
224
|
+
|
225
|
+
red
|
226
|
+
|
227
|
+
red
|
228
|
+
|
229
|
+
red
|
230
|
+
|
231
|
+
blue
|
232
|
+
|
233
|
+
blue
|
234
|
+
|
235
|
+
blue
|
236
|
+
|
237
|
+
blue
|
238
|
+
|
239
|
+
blue
|
240
|
+
|
241
|
+
———————↑③最後までスクロールすると、ここまで表示される(規則性不明)
|
242
|
+
|
243
|
+
```
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
### PeopleListCell.swiftの中身
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
```
|
252
|
+
|
253
|
+
import UIKit
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
class PeopleListCell: UITableViewCell {
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
@IBOutlet weak var tagView: CustomView!
|
262
|
+
|
263
|
+
@IBOutlet weak var ownerImage: UIImageView!
|
264
|
+
|
265
|
+
@IBOutlet weak var peopleName: UILabel!
|
266
|
+
|
267
|
+
@IBOutlet weak var memberCount: UILabel!
|
268
|
+
|
269
|
+
var BGcolor: String?
|
270
|
+
|
271
|
+
var gradientLayerRed = CAGradientLayer()
|
272
|
+
|
273
|
+
var gradientLayerYellow = CAGradientLayer()
|
274
|
+
|
275
|
+
var gradientLayerGreen = CAGradientLayer()
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
override func awakeFromNib() {
|
280
|
+
|
281
|
+
super.awakeFromNib()
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
tagView.roundCorners(corners: [.topRight, .bottomRight], radius: 15)
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
self.layer.shadowColor = UIColor.black.cgColor
|
290
|
+
|
291
|
+
self.layer.shadowOpacity = 0.5 // 透明度
|
292
|
+
|
293
|
+
self.layer.shadowOffset = CGSize(width: 3, height: 3) // 距離
|
294
|
+
|
295
|
+
self.layer.shadowRadius = 3 // ぼかし量
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
// backgroundColorSet()
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
}
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
override func setSelected(_ selected: Bool, animated: Bool) {
|
310
|
+
|
311
|
+
super.setSelected(selected, animated: animated)
|
312
|
+
|
313
|
+
}
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
func backgroundColorSet(){
|
318
|
+
|
319
|
+
// background Redの設定
|
320
|
+
|
321
|
+
let colorRed1 = UIColor(red: 255/256.0, green: 82/256.0, blue: 119/256.0, alpha: 1).cgColor // 左上
|
322
|
+
|
323
|
+
let colorRed2 = UIColor(red: 253/256.0, green: 10/256.0, blue: 61/256.0, alpha: 1).cgColor // 右下
|
324
|
+
|
325
|
+
gradientLayerRed.colors = [colorRed1, colorRed2]
|
326
|
+
|
327
|
+
gradientLayerRed.startPoint = CGPoint.init(x: 0, y: 0)
|
328
|
+
|
329
|
+
gradientLayerRed.endPoint = CGPoint.init(x: 1 , y:1)
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
// background Yellowの設定
|
334
|
+
|
335
|
+
let colorYellow1 = UIColor(red: 249/256.0, green: 193/256.0, blue: 0/256.0, alpha: 1).cgColor // 左上
|
336
|
+
|
337
|
+
let colorYellow2 = UIColor(red: 245/256.0, green: 127/256.0, blue: 0/256.0, alpha: 1).cgColor // 右下
|
338
|
+
|
339
|
+
gradientLayerYellow.colors = [colorYellow1, colorYellow2]
|
340
|
+
|
341
|
+
gradientLayerYellow.startPoint = CGPoint.init(x: 0, y: 0)
|
342
|
+
|
343
|
+
gradientLayerYellow.endPoint = CGPoint.init(x: 1 , y:1)
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
//background Greenの設定
|
348
|
+
|
349
|
+
let colorGreen1 = UIColor(red: 73/256.0, green: 253/256.0, blue: 223/256.0, alpha: 1).cgColor // 左上
|
350
|
+
|
351
|
+
let colorGreen2 = UIColor(red: 0/256.0, green: 170/256.0, blue: 147/256.0, alpha: 1).cgColor // 右下
|
352
|
+
|
353
|
+
gradientLayerGreen.colors = [colorGreen1, colorGreen2]
|
354
|
+
|
355
|
+
gradientLayerGreen.startPoint = CGPoint.init(x: 0, y: 0)
|
356
|
+
|
357
|
+
gradientLayerGreen.endPoint = CGPoint.init(x: 1 , y:1)
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
if BGcolor=="red"{
|
362
|
+
|
363
|
+
gradientLayerRed.frame = tagView.bounds
|
364
|
+
|
365
|
+
tagView.layer.insertSublayer(gradientLayerRed, at:0)
|
366
|
+
|
367
|
+
} else if BGcolor=="yellow"{
|
368
|
+
|
369
|
+
gradientLayerYellow.frame = tagView.bounds
|
370
|
+
|
371
|
+
tagView.layer.insertSublayer(gradientLayerYellow, at:0)
|
372
|
+
|
373
|
+
} else {
|
374
|
+
|
375
|
+
gradientLayerGreen.frame = tagView.bounds
|
376
|
+
|
377
|
+
tagView.layer.insertSublayer(gradientLayerGreen, at:0)
|
378
|
+
|
379
|
+
}
|
380
|
+
|
381
|
+
}
|
382
|
+
|
383
|
+
}
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
```
|
1
不要な文言を削除しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -141,9 +141,3 @@
|
|
141
141
|
}
|
142
142
|
|
143
143
|
```
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
ここにより詳細な情報を記載してください。
|