質問編集履歴
2
追記追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
### 実現したいこと
|
2
2
|
|
3
3
|
ランキングシステムを実装しています。
|
4
|
-
通常の
|
4
|
+
通常の順位はラベルで表示するのですが1位, 2位, 3位だけ画像に置き換えたいです。
|
5
5
|
|
6
6
|
### 前提
|
7
7
|
case 0:
|
@@ -24,6 +24,14 @@
|
|
24
24
|
### 該当のソースコード
|
25
25
|
|
26
26
|
```Swift
|
27
|
+
|
28
|
+
override func viewDidLoad() {
|
29
|
+
super.viewDidLoad()
|
30
|
+
|
31
|
+
// カスタムセル登録
|
32
|
+
tableView.register(UINib(nibName: "CustomTableViewCell", bundle: nil), forCellReuseIdentifier: "CustomTableViewCell")
|
33
|
+
|
34
|
+
}
|
27
35
|
// 中身
|
28
36
|
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
29
37
|
|
@@ -73,6 +81,28 @@
|
|
73
81
|
}
|
74
82
|
```
|
75
83
|
|
84
|
+
```カスタムセル
|
85
|
+
import UIKit
|
86
|
+
|
87
|
+
class CustomTableViewCell: UITableViewCell {
|
88
|
+
|
89
|
+
@IBOutlet weak var id: UILabel!
|
90
|
+
@IBOutlet weak var trendTitle: UILabel!
|
91
|
+
|
92
|
+
override func awakeFromNib() {
|
93
|
+
super.awakeFromNib()
|
94
|
+
// Initialization code
|
95
|
+
}
|
96
|
+
|
97
|
+
override func setSelected(_ selected: Bool, animated: Bool) {
|
98
|
+
super.setSelected(selected, animated: animated)
|
99
|
+
|
100
|
+
// Configure the view for the selected state
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
```
|
105
|
+
|
76
106
|
### 試したこと
|
77
107
|
|
78
108
|
・Swift5 UILabelに画像(UIImage)を表示する NSAttributedString NSTextAttachment
|
1
追記
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Label
|
1
|
+
Labelを画像化したい
|
test
CHANGED
@@ -12,6 +12,8 @@
|
|
12
12
|
imageViewを返す
|
13
13
|
case 3 or デフォルト:
|
14
14
|
Labelを返す
|
15
|
+
|
16
|
+

|
15
17
|
|
16
18
|
### 発生している問題・エラーメッセージ
|
17
19
|
|