質問編集履歴

6

内容修正

2017/08/04 08:32

投稿

po_tato
po_tato

スコア97

test CHANGED
File without changes
test CHANGED
@@ -84,7 +84,7 @@
84
84
 
85
85
  }
86
86
 
87
- cell.layoutWithData(head_img[0])
87
+ cell.data(head_img[0])
88
88
 
89
89
 
90
90
 

5

内容修正

2017/08/04 08:32

投稿

po_tato
po_tato

スコア97

test CHANGED
File without changes
test CHANGED
@@ -174,7 +174,7 @@
174
174
 
175
175
  }else{
176
176
 
177
- guard let cell = table.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? Lpcell else {
177
+ guard let cell = table.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? Headcell else {
178
178
 
179
179
  fatalError("Your cellIdentifier is invalid")
180
180
 

4

本文内容の詳細を変更しました

2017/08/04 08:29

投稿

po_tato
po_tato

スコア97

test CHANGED
File without changes
test CHANGED
@@ -61,3 +61,173 @@
61
61
  else if section==1〜section == 5以降までの部分をループなどで対応したいのですが、
62
62
 
63
63
  エラーなどで出来ません。どのように解決すれば良いでしょうか??
64
+
65
+
66
+
67
+ 具体的には
68
+
69
+ ```
70
+
71
+ func tableView(_ table: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+ if indexPath.section == 0 {
80
+
81
+ guard let cell = table.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? Headcell else {
82
+
83
+ fatalError("Your cellIdentifier is invalid")
84
+
85
+ }
86
+
87
+ cell.layoutWithData(head_img[0])
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+ return cell
96
+
97
+
98
+
99
+ }else if indexPath.section == 1{
100
+
101
+ guard let cell = table.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? Headcell else {
102
+
103
+ fatalError("Your cellIdentifier is invalid")
104
+
105
+ }
106
+
107
+
108
+
109
+ guard self.banner.count != 0 else {
110
+
111
+ return cell
112
+
113
+ }
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+ if self.status[0] == 1000 {
122
+
123
+ cell.data(self.state[0])
124
+
125
+ }else if self.status[0] == 1001{
126
+
127
+ cell.data(self.state2[0])
128
+
129
+ }
130
+
131
+
132
+
133
+
134
+
135
+ return cell
136
+
137
+ }else if indexPath.section == 2{
138
+
139
+ guard let cell = table.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? Headcell else {
140
+
141
+ fatalError("Your cellIdentifier is invalid")
142
+
143
+ }
144
+
145
+
146
+
147
+ guard self.banner.count != 0 else {
148
+
149
+ return cell
150
+
151
+ }
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+ if self.status[1] == 1000 {
160
+
161
+ cell.data(self.state[1])
162
+
163
+ }else if self.status[1] == 1001{
164
+
165
+ cell.data(self.state2[1])
166
+
167
+ }
168
+
169
+
170
+
171
+
172
+
173
+ return cell
174
+
175
+ }else{
176
+
177
+ guard let cell = table.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? Lpcell else {
178
+
179
+ fatalError("Your cellIdentifier is invalid")
180
+
181
+ }
182
+
183
+
184
+
185
+ guard self.banner.count != 0 else {
186
+
187
+ return cell
188
+
189
+ }
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+ if self.status[2] == 1000 {
198
+
199
+ cell.data(self.state[2])
200
+
201
+ }else if self.status[2] == 1001{
202
+
203
+ cell.data(self.state2[2])
204
+
205
+ }
206
+
207
+
208
+
209
+
210
+
211
+ return cell
212
+
213
+ }
214
+
215
+
216
+
217
+ }
218
+
219
+ class Headcell: UITableViewCell {
220
+
221
+ @IBOutlet weak var head: UIImageView!
222
+
223
+ func data(_ img:UIImage) {
224
+
225
+ head.image = img
226
+
227
+
228
+
229
+ }
230
+
231
+ }
232
+
233
+ ```

3

内容分もretunの値変更により変更

2017/08/04 08:28

投稿

po_tato
po_tato

スコア97

test CHANGED
File without changes
test CHANGED
@@ -58,6 +58,6 @@
58
58
 
59
59
  ```
60
60
 
61
- else if section==〜section == 5までの部分をループなどで対応したいのですが、
61
+ else if section==1〜section == 5以降までの部分をループなどで対応したいのですが、
62
62
 
63
63
  エラーなどで出来ません。どのように解決すれば良いでしょうか??

2

return 値修正

2017/08/04 07:22

投稿

po_tato
po_tato

スコア97

test CHANGED
File without changes
test CHANGED
@@ -26,7 +26,7 @@
26
26
 
27
27
  if section == 0 {
28
28
 
29
- return 5
29
+ return 10
30
30
 
31
31
  }else if section == 1 {
32
32
 
@@ -50,7 +50,7 @@
50
50
 
51
51
  }else{
52
52
 
53
- return 30
53
+ return 5
54
54
 
55
55
  }
56
56
 

1

returnの値を変更しました。

2017/08/04 07:21

投稿

po_tato
po_tato

スコア97

test CHANGED
File without changes
test CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  if section == 0 {
8
8
 
9
- return 0
9
+ return 5
10
10
 
11
11
  }else{
12
12
 
@@ -26,15 +26,15 @@
26
26
 
27
27
  if section == 0 {
28
28
 
29
- return 0
29
+ return 5
30
30
 
31
31
  }else if section == 1 {
32
32
 
33
- return 20
33
+ return 5
34
34
 
35
35
  }else if section == 2 {
36
36
 
37
- return 10
37
+ return 5
38
38
 
39
39
  }else if section == 3 {
40
40