質問編集履歴

1

</>ボタンを使って修正。funcの前のコードを一部追加。

2017/02/28 13:33

投稿

M_taka08
M_taka08

スコア8

test CHANGED
File without changes
test CHANGED
@@ -40,7 +40,41 @@
40
40
 
41
41
  ###該当のソースコード
42
42
 
43
+ ```
44
+
45
+
46
+
47
+ @IBOutlet weak var searchCity: UISearchBar!
48
+
49
+ @IBOutlet weak var tableView: UITableView!
50
+
51
+
52
+
53
+ //サーチボタンクリック時
54
+
55
+ func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
56
+
57
+ //キーボードを閉じる
58
+
59
+ view.endEditing(true)
60
+
61
+ //デバックエリアに出力
62
+
63
+ print(searchBar.text!)
64
+
65
+
66
+
67
+ if let searchWord = searchBar.text {
68
+
69
+ //入力されたら都市を検索
70
+
71
+ searchCity(keyword: searchWord)
72
+
73
+ }
74
+
75
+ }
76
+
43
- func searchCity(keyword : String){
77
+ func searchCity(keyword : String){
44
78
 
45
79
 
46
80
 
@@ -94,6 +128,10 @@
94
128
 
95
129
  }
96
130
 
131
+ ```
132
+
133
+
134
+
97
135
 
98
136
 
99
137
  ###試したこと