teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

コードのレイアウトを編集

2016/08/18 00:03

投稿

mi-na
mi-na

スコア12

title CHANGED
File without changes
body CHANGED
@@ -38,7 +38,7 @@
38
38
 
39
39
  以下の箇所で実行しています。
40
40
 
41
- ```ここに言語を入力
41
+ ```swift
42
42
  class XXXXList: UIViewController, UITableViewDelegate, UITableViewDataSource {
43
43
  override func viewDidLoad() {
44
44
  super.viewDidLoad()
@@ -47,9 +47,13 @@
47
47
  func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
48
48
  // 再利用するCellを取得する.
49
49
  let cell = tableView.dequeueReusableCellWithIdentifier("MyCell", forIndexPath: indexPath)
50
+
50
51
  cell.textLabel!.text = "表示するタイトル"
52
+
51
53
  let url:NSURL = NSURL(string: "画像のurl")!
52
- cell.imageView!.sd_setImageWithURL(url) return cell
54
+ cell.imageView!.sd_setImageWithURL(url)
55
+
56
+ return cell
53
57
  }
54
- }
58
+ }
55
59
  ```

1

実行箇所を追記

2016/08/18 00:03

投稿

mi-na
mi-na

スコア12

title CHANGED
File without changes
body CHANGED
@@ -31,4 +31,25 @@
31
31
  1回目でも画像を表示するにはどうすればいいのでしょうか?
32
32
  「SDWebImage」で検索しても初回は別の方法で表示しなければいけない等は見つけられませんでした。
33
33
 
34
- よろしくお願いします。
34
+ よろしくお願いします。
35
+
36
+
37
+ ---
38
+
39
+ 以下の箇所で実行しています。
40
+
41
+ ```ここに言語を入力
42
+ class XXXXList: UIViewController, UITableViewDelegate, UITableViewDataSource {
43
+ override func viewDidLoad() {
44
+ super.viewDidLoad()
45
+ ((省略))
46
+ }
47
+ func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
48
+ // 再利用するCellを取得する.
49
+ let cell = tableView.dequeueReusableCellWithIdentifier("MyCell", forIndexPath: indexPath)
50
+ cell.textLabel!.text = "表示するタイトル"
51
+ let url:NSURL = NSURL(string: "画像のurl")!
52
+ cell.imageView!.sd_setImageWithURL(url) return cell
53
+ }
54
+ }
55
+ ```