質問編集履歴
11
プログラムの修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -132,6 +132,8 @@
|
|
132
132
|
|
133
133
|
self.damiTemperatures = [[NSMutableArray alloc] init];
|
134
134
|
|
135
|
+
self.array = [[NSMutableArray alloc] init];
|
136
|
+
|
135
137
|
|
136
138
|
|
137
139
|
// DelegateとDataSourceはstoryboard(またはxib)のところで結び付けるのでもO.K.
|
@@ -166,8 +168,6 @@
|
|
166
168
|
|
167
169
|
// query.skip = 4;
|
168
170
|
|
169
|
-
//クエリを取得順に
|
170
|
-
|
171
171
|
[query orderByDescending:@"createDate"];
|
172
172
|
|
173
173
|
query.limit = 40;
|
@@ -246,10 +246,12 @@
|
|
246
246
|
|
247
247
|
}
|
248
248
|
|
249
|
-
|
249
|
+
|
250
250
|
|
251
251
|
}
|
252
252
|
|
253
|
+
[self.tblView reloadData];
|
254
|
+
|
253
255
|
}
|
254
256
|
|
255
257
|
|
@@ -284,15 +286,29 @@
|
|
284
286
|
|
285
287
|
|
286
288
|
|
289
|
+
return [self.array count];
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
}
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
/*
|
300
|
+
|
301
|
+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
302
|
+
|
303
|
+
|
304
|
+
|
287
305
|
return [self.amountwaters count];
|
288
306
|
|
289
307
|
|
290
308
|
|
291
309
|
}
|
292
310
|
|
293
|
-
|
311
|
+
*/
|
294
|
-
|
295
|
-
|
296
312
|
|
297
313
|
// セルの内容を設定
|
298
314
|
|
10
コメント追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -166,6 +166,8 @@
|
|
166
166
|
|
167
167
|
// query.skip = 4;
|
168
168
|
|
169
|
+
//クエリを取得順に
|
170
|
+
|
169
171
|
[query orderByDescending:@"createDate"];
|
170
172
|
|
171
173
|
query.limit = 40;
|
@@ -474,7 +476,7 @@
|
|
474
476
|
|
475
477
|
| value| || value | value || ||2018-11-15T21:29:37.942+09:00|
|
476
478
|
|
477
|
-
//以下省略しています
|
479
|
+
//以下省略しています,valueには何かしらの値が入っています
|
478
480
|
|
479
481
|
### 試したこと
|
480
482
|
|
9
DBの中身追加しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -462,6 +462,20 @@
|
|
462
462
|
|
463
463
|
```
|
464
464
|
|
465
|
+
//DBの中身
|
466
|
+
|
467
|
+
|damileaf|date|hikakuleaf||kaerumsg||water||createDate|
|
468
|
+
|
469
|
+
| |11/15|| | | ||value ||2018-11-15T21:29:37.942+09:00|
|
470
|
+
|
471
|
+
| value| || value | value || ||2018-11-15T21:29:37.942+09:00|
|
472
|
+
|
473
|
+
| |11/15|| | | ||value ||2018-11-15T21:29:37.942+09:00|
|
474
|
+
|
475
|
+
| value| || value | value || ||2018-11-15T21:29:37.942+09:00|
|
476
|
+
|
477
|
+
//以下省略しています
|
478
|
+
|
465
479
|
### 試したこと
|
466
480
|
|
467
481
|
|
8
プログラム修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -100,8 +100,6 @@
|
|
100
100
|
|
101
101
|
|
102
102
|
|
103
|
-
|
104
|
-
|
105
103
|
@end
|
106
104
|
|
107
105
|
|
@@ -134,13 +132,15 @@
|
|
134
132
|
|
135
133
|
self.damiTemperatures = [[NSMutableArray alloc] init];
|
136
134
|
|
135
|
+
|
136
|
+
|
137
137
|
// DelegateとDataSourceはstoryboard(またはxib)のところで結び付けるのでもO.K.
|
138
138
|
|
139
139
|
_tblView.delegate = self;
|
140
140
|
|
141
141
|
_tblView.dataSource = self;
|
142
142
|
|
143
|
-
|
143
|
+
|
144
144
|
|
145
145
|
// カスタムセルを使用
|
146
146
|
|
@@ -150,225 +150,111 @@
|
|
150
150
|
|
151
151
|
|
152
152
|
|
153
|
-
//保存したデータの検索と取得
|
154
|
-
|
155
|
-
[self
|
153
|
+
[self kaeruQuery];
|
156
|
-
|
157
|
-
|
154
|
+
|
158
|
-
|
159
|
-
|
155
|
+
|
160
|
-
|
161
|
-
|
156
|
+
|
162
|
-
|
163
|
-
|
157
|
+
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
158
|
+
|
169
|
-
}
|
159
|
+
}
|
170
|
-
|
171
|
-
|
172
|
-
|
160
|
+
|
173
|
-
-
|
161
|
+
-(void)kaeruQuery
|
162
|
+
|
163
|
+
{
|
174
164
|
|
175
165
|
NCMBQuery *query = [NCMBQuery queryWithClassName:@"HAGE"];
|
176
166
|
|
177
|
-
//
|
178
|
-
|
179
|
-
query
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
f
|
194
|
-
|
195
|
-
NSMutableArray
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
}
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
[
|
242
|
-
|
243
|
-
NS
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
[self.
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
}
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
}
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
|
272
|
-
|
273
|
-
if (objects!= nil && [objects isKindOfClass:[NSArray class]]){
|
274
|
-
|
275
|
-
if (!error) {
|
276
|
-
|
277
|
-
for (NCMBObject *object in objects) {
|
278
|
-
|
279
|
-
NSMutableArray *hoge3 = [object objectForKey:@"date"];
|
280
|
-
|
281
|
-
[self.dates addObject:hoge3];
|
282
|
-
|
283
|
-
NSLog(@"%@",self.dates);
|
284
|
-
|
285
|
-
}
|
286
|
-
|
287
|
-
[self.tblView reloadData];
|
288
|
-
|
289
|
-
}
|
290
|
-
|
291
|
-
}
|
292
|
-
|
293
|
-
}];
|
294
|
-
|
295
|
-
}
|
296
|
-
|
297
|
-
- (void)setupData4 {
|
298
|
-
|
299
|
-
NCMBQuery *query = [NCMBQuery queryWithClassName:@"HAGE"];
|
300
|
-
|
301
|
-
// 検索件数を設定
|
302
|
-
|
303
|
-
query.limit = 10;
|
304
|
-
|
305
|
-
[query whereKey:@"hikakuleaf" notEqualTo:[NSNull null]];
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
|
310
|
-
|
311
|
-
if (objects!= nil && [objects isKindOfClass:[NSArray class]]){
|
312
|
-
|
313
|
-
if (!error) {
|
314
|
-
|
315
|
-
for (NCMBObject *object in objects) {
|
316
|
-
|
317
|
-
NSMutableArray *hoge4 = [object objectForKey:@"hikakuleaf"];
|
318
|
-
|
319
|
-
[self.realTemperatures addObject:hoge4];
|
320
|
-
|
321
|
-
NSLog(@"%@",self.realTemperatures);
|
322
|
-
|
323
|
-
}
|
324
|
-
|
325
|
-
[self.tblView reloadData];
|
326
|
-
|
327
|
-
}
|
328
|
-
|
329
|
-
}
|
330
|
-
|
331
|
-
}];
|
332
|
-
|
333
|
-
}
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
- (void)setupData5 {
|
338
|
-
|
339
|
-
NCMBQuery *query = [NCMBQuery queryWithClassName:@"HAGE"];
|
340
|
-
|
341
|
-
// 検索件数を設定
|
342
|
-
|
343
|
-
query.limit = 10;
|
344
|
-
|
345
|
-
[query whereKey:@"damileaf" notEqualTo:[NSNull null]];
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
|
350
|
-
|
351
|
-
if (objects!= nil && [objects isKindOfClass:[NSArray class]]){
|
352
|
-
|
353
|
-
if (!error) {
|
354
|
-
|
355
|
-
for (NCMBObject *object in objects) {
|
356
|
-
|
357
|
-
NSMutableArray *hoge5 = [object objectForKey:@"damileaf"];
|
358
|
-
|
359
|
-
[self.damiTemperatures addObject:hoge5];
|
360
|
-
|
361
|
-
NSLog(@"%@",self.damiTemperatures);
|
362
|
-
|
363
|
-
}
|
364
|
-
|
365
|
-
[self.tblView reloadData];
|
366
|
-
|
367
|
-
}
|
368
|
-
|
369
|
-
}
|
370
|
-
|
371
|
-
}];
|
167
|
+
// query.skip = 4;
|
168
|
+
|
169
|
+
[query orderByDescending:@"createDate"];
|
170
|
+
|
171
|
+
query.limit = 40;
|
172
|
+
|
173
|
+
[query findObjectsInBackgroundWithBlock:^(NSArray *array, NSError *error)
|
174
|
+
|
175
|
+
{
|
176
|
+
|
177
|
+
if (!error) {
|
178
|
+
|
179
|
+
for (NCMBObject *obj in array) {
|
180
|
+
|
181
|
+
{
|
182
|
+
|
183
|
+
if ([obj objectForKey:@"kaerumsg"]) {
|
184
|
+
|
185
|
+
NSMutableArray* hoge1;
|
186
|
+
|
187
|
+
hoge1 = [obj objectForKey:@"kaerumsg"];
|
188
|
+
|
189
|
+
[self.msgs addObject:hoge1];
|
190
|
+
|
191
|
+
NSLog(@"%@",self.msgs);
|
192
|
+
|
193
|
+
}
|
194
|
+
|
195
|
+
if ([obj objectForKey:@"water"]) {
|
196
|
+
|
197
|
+
NSMutableArray* hoge2;
|
198
|
+
|
199
|
+
hoge2 = [obj objectForKey:@"water"];
|
200
|
+
|
201
|
+
[self.amountwaters addObject:hoge2];
|
202
|
+
|
203
|
+
NSLog(@"%@",self.amountwaters);
|
204
|
+
|
205
|
+
}
|
206
|
+
|
207
|
+
if ([obj objectForKey:@"date"]) {
|
208
|
+
|
209
|
+
NSMutableArray* hoge3;
|
210
|
+
|
211
|
+
hoge3 = [obj objectForKey:@"date"];
|
212
|
+
|
213
|
+
[self.dates addObject:hoge3];
|
214
|
+
|
215
|
+
NSLog(@"%@",self.dates);
|
216
|
+
|
217
|
+
}
|
218
|
+
|
219
|
+
if ([obj objectForKey:@"hikakuleaf"]) {
|
220
|
+
|
221
|
+
NSMutableArray *hoge4;
|
222
|
+
|
223
|
+
hoge4 = [obj objectForKey:@"hikakuleaf"];
|
224
|
+
|
225
|
+
[self.realTemperatures addObject:hoge4];
|
226
|
+
|
227
|
+
NSLog(@"%@",self.realTemperatures);
|
228
|
+
|
229
|
+
}
|
230
|
+
|
231
|
+
if ([obj objectForKey:@"damileaf"]) {
|
232
|
+
|
233
|
+
NSMutableArray *hoge5;
|
234
|
+
|
235
|
+
hoge5 = [obj objectForKey:@"damileaf"];
|
236
|
+
|
237
|
+
[self.damiTemperatures addObject:hoge5];
|
238
|
+
|
239
|
+
NSLog(@"%@",self.realTemperatures);
|
240
|
+
|
241
|
+
}
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
}
|
246
|
+
|
247
|
+
[self.tblView reloadData];
|
248
|
+
|
249
|
+
}
|
250
|
+
|
251
|
+
}
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
}];
|
372
258
|
|
373
259
|
}
|
374
260
|
|
@@ -394,7 +280,7 @@
|
|
394
280
|
|
395
281
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
396
282
|
|
397
|
-
|
283
|
+
|
398
284
|
|
399
285
|
return [self.amountwaters count];
|
400
286
|
|
@@ -434,6 +320,8 @@
|
|
434
320
|
|
435
321
|
|
436
322
|
|
323
|
+
|
324
|
+
|
437
325
|
cell.msg.text = [self.msgs objectAtIndex:indexPath.row];
|
438
326
|
|
439
327
|
cell.amountwater.text = [self.amountwaters objectAtIndex:indexPath.row];
|
@@ -444,7 +332,21 @@
|
|
444
332
|
|
445
333
|
cell.damiTemperature.text = [self.damiTemperatures objectAtIndex:indexPath.row];
|
446
334
|
|
335
|
+
|
336
|
+
|
447
|
-
|
337
|
+
/*
|
338
|
+
|
339
|
+
cell.msg.text = self.msgs [indexPath.row];
|
340
|
+
|
341
|
+
cell.amountwater.text = self.amountwaters [indexPath.row];
|
342
|
+
|
343
|
+
cell.date.text = self.dates [indexPath.row];
|
344
|
+
|
345
|
+
cell.realTemperature.text = self.realTemperatures [indexPath.row];
|
346
|
+
|
347
|
+
cell.damiTemperature.text = self.damiTemperatures [indexPath.row];*/
|
348
|
+
|
349
|
+
|
448
350
|
|
449
351
|
return cell;
|
450
352
|
|
@@ -466,7 +368,7 @@
|
|
466
368
|
|
467
369
|
CustomCell *Cell = [self.tblView dequeueReusableCellWithIdentifier:@"Cell"];
|
468
370
|
|
469
|
-
|
371
|
+
|
470
372
|
|
471
373
|
//とりあえず固定値に
|
472
374
|
|
@@ -556,6 +458,8 @@
|
|
556
458
|
|
557
459
|
@end
|
558
460
|
|
461
|
+
|
462
|
+
|
559
463
|
```
|
560
464
|
|
561
465
|
### 試したこと
|
7
プログラム変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -98,7 +98,7 @@
|
|
98
98
|
|
99
99
|
}
|
100
100
|
|
101
|
-
|
101
|
+
|
102
102
|
|
103
103
|
|
104
104
|
|
@@ -124,14 +124,22 @@
|
|
124
124
|
|
125
125
|
[super viewDidLoad];
|
126
126
|
|
127
|
+
self.msgs = [[NSMutableArray alloc] init];
|
128
|
+
|
129
|
+
self.amountwaters = [[NSMutableArray alloc] init];
|
130
|
+
|
131
|
+
self.dates = [[NSMutableArray alloc] init];
|
132
|
+
|
133
|
+
self.realTemperatures = [[NSMutableArray alloc] init];
|
134
|
+
|
135
|
+
self.damiTemperatures = [[NSMutableArray alloc] init];
|
136
|
+
|
127
137
|
// DelegateとDataSourceはstoryboard(またはxib)のところで結び付けるのでもO.K.
|
128
138
|
|
129
139
|
_tblView.delegate = self;
|
130
140
|
|
131
141
|
_tblView.dataSource = self;
|
132
142
|
|
133
|
-
self.msgs = [[NSMutableArray alloc] init];
|
134
|
-
|
135
143
|
|
136
144
|
|
137
145
|
// カスタムセルを使用
|
@@ -144,71 +152,227 @@
|
|
144
152
|
|
145
153
|
//保存したデータの検索と取得
|
146
154
|
|
147
|
-
[self setupData];
|
155
|
+
[self setupData1];
|
156
|
+
|
148
|
-
|
157
|
+
[self setupData2];
|
158
|
+
|
149
|
-
|
159
|
+
[self setupData3];
|
160
|
+
|
150
|
-
|
161
|
+
[self setupData4];
|
162
|
+
|
163
|
+
[self setupData5];
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
151
|
-
}
|
169
|
+
}
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
170
|
+
|
156
|
-
|
157
|
-
|
158
|
-
|
171
|
+
|
172
|
+
|
159
|
-
- (void)setupData {
|
173
|
+
- (void)setupData1 {
|
160
|
-
|
161
|
-
|
174
|
+
|
162
|
-
|
163
|
-
NCMBQuery *query = [NCMBQuery queryWithClassName:@"H
|
175
|
+
NCMBQuery *query = [NCMBQuery queryWithClassName:@"HAGE"];
|
164
176
|
|
165
177
|
// 検索件数を設定
|
166
178
|
|
167
|
-
query.limit =
|
179
|
+
query.limit = 10;
|
168
|
-
|
169
|
-
|
170
180
|
|
171
181
|
[query whereKey:@"kaerumsg" notEqualTo:[NSNull null]];
|
172
182
|
|
173
|
-
|
183
|
+
// [query whereKey:@"water" notEqualTo:[NSNull null]];
|
184
|
+
|
185
|
+
|
174
186
|
|
175
187
|
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
|
176
188
|
|
189
|
+
if (objects!= nil && [objects isKindOfClass:[NSArray class]]){
|
190
|
+
|
177
|
-
if (error) {
|
191
|
+
if (!error) {
|
178
|
-
|
179
|
-
|
192
|
+
|
180
|
-
|
181
|
-
NSLog(@"検索に失敗しました。エラーコード:%ld", error.code);
|
182
|
-
|
183
|
-
} else {
|
184
|
-
|
185
|
-
// 検索に成功した場合の処理
|
186
|
-
|
187
|
-
NSLog(@"検索に成功しました。");
|
188
|
-
|
189
|
-
//[self.msgs removeAllObjects];
|
190
|
-
|
191
|
-
for (NCMBObject *object in objects){
|
193
|
+
for (NCMBObject *object in objects) {
|
192
|
-
|
194
|
+
|
193
|
-
|
195
|
+
NSMutableArray *hoge1 = [object objectForKey:@"kaerumsg"];
|
196
|
+
|
194
|
-
|
197
|
+
// NSMutableArray *hoge2 = [object objectForKey:@"water"];
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
[self.msgs addObject:hoge1];
|
202
|
+
|
195
|
-
NSLog(@"%@",self.msgs);
|
203
|
+
NSLog(@"%@",self.msgs);
|
196
204
|
|
197
205
|
}
|
198
206
|
|
199
|
-
|
207
|
+
[self.tblView reloadData];
|
200
|
-
|
208
|
+
|
201
|
-
}
|
209
|
+
}
|
210
|
+
|
202
|
-
|
211
|
+
}
|
203
|
-
|
204
212
|
|
205
213
|
}];
|
206
214
|
|
207
|
-
// **************************************************
|
208
|
-
|
209
|
-
//
|
210
|
-
|
211
|
-
}
|
215
|
+
}
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
- (void)setupData2 {
|
220
|
+
|
221
|
+
NCMBQuery *query = [NCMBQuery queryWithClassName:@"HAGE"];
|
222
|
+
|
223
|
+
// 検索件数を設定
|
224
|
+
|
225
|
+
query.limit = 10;
|
226
|
+
|
227
|
+
[query whereKey:@"water" notEqualTo:[NSNull null]];
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
|
232
|
+
|
233
|
+
if (objects!= nil && [objects isKindOfClass:[NSArray class]]){
|
234
|
+
|
235
|
+
if (!error) {
|
236
|
+
|
237
|
+
for (NCMBObject *object in objects) {
|
238
|
+
|
239
|
+
NSMutableArray *hoge2 = [object objectForKey:@"water"];
|
240
|
+
|
241
|
+
[self.amountwaters addObject:hoge2];
|
242
|
+
|
243
|
+
NSLog(@"%@",self.amountwaters);
|
244
|
+
|
245
|
+
}
|
246
|
+
|
247
|
+
[self.tblView reloadData];
|
248
|
+
|
249
|
+
}
|
250
|
+
|
251
|
+
}
|
252
|
+
|
253
|
+
}];
|
254
|
+
|
255
|
+
}
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
- (void)setupData3 {
|
260
|
+
|
261
|
+
NCMBQuery *query = [NCMBQuery queryWithClassName:@"HAGE"];
|
262
|
+
|
263
|
+
// 検索件数を設定
|
264
|
+
|
265
|
+
query.limit = 10;
|
266
|
+
|
267
|
+
[query whereKey:@"date" notEqualTo:[NSNull null]];
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
|
272
|
+
|
273
|
+
if (objects!= nil && [objects isKindOfClass:[NSArray class]]){
|
274
|
+
|
275
|
+
if (!error) {
|
276
|
+
|
277
|
+
for (NCMBObject *object in objects) {
|
278
|
+
|
279
|
+
NSMutableArray *hoge3 = [object objectForKey:@"date"];
|
280
|
+
|
281
|
+
[self.dates addObject:hoge3];
|
282
|
+
|
283
|
+
NSLog(@"%@",self.dates);
|
284
|
+
|
285
|
+
}
|
286
|
+
|
287
|
+
[self.tblView reloadData];
|
288
|
+
|
289
|
+
}
|
290
|
+
|
291
|
+
}
|
292
|
+
|
293
|
+
}];
|
294
|
+
|
295
|
+
}
|
296
|
+
|
297
|
+
- (void)setupData4 {
|
298
|
+
|
299
|
+
NCMBQuery *query = [NCMBQuery queryWithClassName:@"HAGE"];
|
300
|
+
|
301
|
+
// 検索件数を設定
|
302
|
+
|
303
|
+
query.limit = 10;
|
304
|
+
|
305
|
+
[query whereKey:@"hikakuleaf" notEqualTo:[NSNull null]];
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
|
310
|
+
|
311
|
+
if (objects!= nil && [objects isKindOfClass:[NSArray class]]){
|
312
|
+
|
313
|
+
if (!error) {
|
314
|
+
|
315
|
+
for (NCMBObject *object in objects) {
|
316
|
+
|
317
|
+
NSMutableArray *hoge4 = [object objectForKey:@"hikakuleaf"];
|
318
|
+
|
319
|
+
[self.realTemperatures addObject:hoge4];
|
320
|
+
|
321
|
+
NSLog(@"%@",self.realTemperatures);
|
322
|
+
|
323
|
+
}
|
324
|
+
|
325
|
+
[self.tblView reloadData];
|
326
|
+
|
327
|
+
}
|
328
|
+
|
329
|
+
}
|
330
|
+
|
331
|
+
}];
|
332
|
+
|
333
|
+
}
|
334
|
+
|
335
|
+
|
336
|
+
|
337
|
+
- (void)setupData5 {
|
338
|
+
|
339
|
+
NCMBQuery *query = [NCMBQuery queryWithClassName:@"HAGE"];
|
340
|
+
|
341
|
+
// 検索件数を設定
|
342
|
+
|
343
|
+
query.limit = 10;
|
344
|
+
|
345
|
+
[query whereKey:@"damileaf" notEqualTo:[NSNull null]];
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
|
350
|
+
|
351
|
+
if (objects!= nil && [objects isKindOfClass:[NSArray class]]){
|
352
|
+
|
353
|
+
if (!error) {
|
354
|
+
|
355
|
+
for (NCMBObject *object in objects) {
|
356
|
+
|
357
|
+
NSMutableArray *hoge5 = [object objectForKey:@"damileaf"];
|
358
|
+
|
359
|
+
[self.damiTemperatures addObject:hoge5];
|
360
|
+
|
361
|
+
NSLog(@"%@",self.damiTemperatures);
|
362
|
+
|
363
|
+
}
|
364
|
+
|
365
|
+
[self.tblView reloadData];
|
366
|
+
|
367
|
+
}
|
368
|
+
|
369
|
+
}
|
370
|
+
|
371
|
+
}];
|
372
|
+
|
373
|
+
}
|
374
|
+
|
375
|
+
|
212
376
|
|
213
377
|
|
214
378
|
|
@@ -230,7 +394,11 @@
|
|
230
394
|
|
231
395
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
232
396
|
|
397
|
+
|
398
|
+
|
233
|
-
return
|
399
|
+
return [self.amountwaters count];
|
400
|
+
|
401
|
+
|
234
402
|
|
235
403
|
}
|
236
404
|
|
@@ -252,9 +420,29 @@
|
|
252
420
|
|
253
421
|
CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
|
254
422
|
|
423
|
+
|
424
|
+
|
255
|
-
|
425
|
+
cell.date.numberOfLines = 0;
|
426
|
+
|
256
|
-
|
427
|
+
cell.amountwater.numberOfLines = 0;
|
428
|
+
|
429
|
+
cell.damiTemperature.numberOfLines = 0;
|
430
|
+
|
431
|
+
cell.realTemperature.numberOfLines = 0;
|
432
|
+
|
433
|
+
cell.msg.numberOfLines = 0;
|
434
|
+
|
435
|
+
|
436
|
+
|
257
|
-
cell.msg.text = self.msgs
|
437
|
+
cell.msg.text = [self.msgs objectAtIndex:indexPath.row];
|
438
|
+
|
439
|
+
cell.amountwater.text = [self.amountwaters objectAtIndex:indexPath.row];
|
440
|
+
|
441
|
+
cell.date.text = [self.dates objectAtIndex:indexPath.row];
|
442
|
+
|
443
|
+
cell.realTemperature.text = [self.realTemperatures objectAtIndex:indexPath.row];
|
444
|
+
|
445
|
+
cell.damiTemperature.text = [self.damiTemperatures objectAtIndex:indexPath.row];
|
258
446
|
|
259
447
|
|
260
448
|
|
@@ -298,6 +486,8 @@
|
|
298
486
|
|
299
487
|
*/
|
300
488
|
|
489
|
+
|
490
|
+
|
301
491
|
- (CGFloat)calcHeight:(NSString *)text {
|
302
492
|
|
303
493
|
|
@@ -338,6 +528,8 @@
|
|
338
528
|
|
339
529
|
|
340
530
|
|
531
|
+
|
532
|
+
|
341
533
|
// セル押下時の処理
|
342
534
|
|
343
535
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
@@ -364,8 +556,6 @@
|
|
364
556
|
|
365
557
|
@end
|
366
558
|
|
367
|
-
|
368
|
-
|
369
559
|
```
|
370
560
|
|
371
561
|
### 試したこと
|
6
文法の訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -190,7 +190,7 @@
|
|
190
190
|
|
191
191
|
for (NCMBObject *object in objects){
|
192
192
|
|
193
|
-
[msgs addObject:[object objectForKey:@"kaerumsg"]];
|
193
|
+
[self.msgs addObject:[object objectForKey:@"kaerumsg"]];
|
194
194
|
|
195
195
|
NSLog(@"%@",self.msgs);
|
196
196
|
|
5
プログラムの訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -190,9 +190,9 @@
|
|
190
190
|
|
191
191
|
for (NCMBObject *object in objects){
|
192
192
|
|
193
|
-
|
193
|
+
[msgs addObject:[object objectForKey:@"kaerumsg"]];
|
194
|
-
|
194
|
+
|
195
|
-
|
195
|
+
NSLog(@"%@",self.msgs);
|
196
196
|
|
197
197
|
}
|
198
198
|
|
4
プログラムの訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -96,17 +96,9 @@
|
|
96
96
|
|
97
97
|
|
98
98
|
|
99
|
-
|
100
|
-
|
101
|
-
// NSMutableArray *waters;
|
102
|
-
|
103
|
-
// NSMutableArray *msgs;
|
104
|
-
|
105
|
-
}
|
99
|
+
}
|
106
|
-
|
100
|
+
|
107
|
-
@property (r
|
101
|
+
@property (strong,nonatomic)NSMutableArray *vals;
|
108
|
-
|
109
|
-
|
110
102
|
|
111
103
|
|
112
104
|
|
@@ -122,17 +114,7 @@
|
|
122
114
|
|
123
115
|
@implementation SecandViewController
|
124
116
|
|
125
|
-
|
117
|
+
|
126
|
-
|
127
|
-
if (!_msgs) {
|
128
|
-
|
129
|
-
_msgs = [[NSMutableArray alloc] init];
|
130
|
-
|
131
|
-
}
|
132
|
-
|
133
|
-
return _msgs;
|
134
|
-
|
135
|
-
}
|
136
118
|
|
137
119
|
#pragma mark Life Cycle
|
138
120
|
|
@@ -148,7 +130,9 @@
|
|
148
130
|
|
149
131
|
_tblView.dataSource = self;
|
150
132
|
|
151
|
-
|
133
|
+
self.msgs = [[NSMutableArray alloc] init];
|
134
|
+
|
135
|
+
|
152
136
|
|
153
137
|
// カスタムセルを使用
|
154
138
|
|
@@ -186,12 +170,6 @@
|
|
186
170
|
|
187
171
|
[query whereKey:@"kaerumsg" notEqualTo:[NSNull null]];
|
188
172
|
|
189
|
-
// [query whereKey:@"water" notEqualTo:[NSNull null]];
|
190
|
-
|
191
|
-
// [query whereKey:@"water" notEqualTo:[NSNull null]];
|
192
|
-
|
193
|
-
// [query orderByAscending:@"kaerumsg"];
|
194
|
-
|
195
173
|
//データストアを検索
|
196
174
|
|
197
175
|
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
|
@@ -212,19 +190,9 @@
|
|
212
190
|
|
213
191
|
for (NCMBObject *object in objects){
|
214
192
|
|
215
|
-
// vals = [object objectForKey:@"kaerumsg"];
|
216
|
-
|
217
|
-
// [self.msgs addObject:vals];
|
218
|
-
|
219
|
-
|
193
|
+
self.msgs = [object objectForKey:@"kaerumsg"];
|
220
|
-
|
221
|
-
|
194
|
+
|
222
|
-
|
223
|
-
NSLog(@"%@",
|
195
|
+
NSLog(@"%@",self.msgs);
|
224
|
-
|
225
|
-
// [waters addObject:[object objectForKey:@"water"]];
|
226
|
-
|
227
|
-
// NSLog(@"%@",waters);
|
228
196
|
|
229
197
|
}
|
230
198
|
|
@@ -286,17 +254,9 @@
|
|
286
254
|
|
287
255
|
|
288
256
|
|
289
|
-
cell.msg.numberOfLines = 0;
|
290
|
-
|
291
|
-
// cell.amountwater.numberOfLines = 0;
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
// cell.msg.text = (NSString*)msgs;
|
296
|
-
|
297
|
-
cell.msg.text =
|
257
|
+
cell.msg.text = self.msgs[indexPath.row];
|
298
|
-
|
299
|
-
|
258
|
+
|
259
|
+
|
300
260
|
|
301
261
|
return cell;
|
302
262
|
|
@@ -406,8 +366,6 @@
|
|
406
366
|
|
407
367
|
|
408
368
|
|
409
|
-
|
410
|
-
|
411
369
|
```
|
412
370
|
|
413
371
|
### 試したこと
|
3
ヘッダーファイルの追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -32,8 +32,50 @@
|
|
32
32
|
|
33
33
|
|
34
34
|
|
35
|
+
|
36
|
+
|
37
|
+
```
|
38
|
+
|
39
|
+
//hファイルです。
|
40
|
+
|
41
|
+
#import <UIKit/UIKit.h>
|
42
|
+
|
43
|
+
#import "TransitionObj.h"
|
44
|
+
|
45
|
+
#import "CustomCell.h"
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
@interface SecandViewController : UIViewController<UITableViewDelegate,UITableViewDataSource>
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
//@property (weak, nonatomic) IBOutlet UILabel *l1v;
|
54
|
+
|
55
|
+
@property (strong, nonatomic) TransitionObj* transitionObj;
|
56
|
+
|
57
|
+
//@property (weak, nonatomic) IBOutlet UITextField *f2v;
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
// テーブルビュー
|
62
|
+
|
63
|
+
@property (weak, nonatomic) IBOutlet UITableView *tblView;
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
@end
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
```
|
74
|
+
|
35
75
|
```Objective-C
|
36
76
|
|
77
|
+
//mファイルです。
|
78
|
+
|
37
79
|
#import <Foundation/Foundation.h>
|
38
80
|
|
39
81
|
#import "SecandViewController.h"
|
@@ -54,9 +96,17 @@
|
|
54
96
|
|
55
97
|
|
56
98
|
|
99
|
+
|
100
|
+
|
101
|
+
// NSMutableArray *waters;
|
102
|
+
|
57
|
-
|
103
|
+
// NSMutableArray *msgs;
|
58
|
-
|
104
|
+
|
59
|
-
}
|
105
|
+
}
|
106
|
+
|
107
|
+
@property (retain, nonatomic)NSMutableArray *msgs;
|
108
|
+
|
109
|
+
|
60
110
|
|
61
111
|
|
62
112
|
|
@@ -72,7 +122,17 @@
|
|
72
122
|
|
73
123
|
@implementation SecandViewController
|
74
124
|
|
75
|
-
|
125
|
+
- (NSMutableArray *)msgs{
|
126
|
+
|
127
|
+
if (!_msgs) {
|
128
|
+
|
129
|
+
_msgs = [[NSMutableArray alloc] init];
|
130
|
+
|
131
|
+
}
|
132
|
+
|
133
|
+
return _msgs;
|
134
|
+
|
135
|
+
}
|
76
136
|
|
77
137
|
#pragma mark Life Cycle
|
78
138
|
|
@@ -114,8 +174,6 @@
|
|
114
174
|
|
115
175
|
- (void)setupData {
|
116
176
|
|
117
|
-
|
118
|
-
|
119
177
|
// GameScoreクラスを検索するクエリを作成
|
120
178
|
|
121
179
|
NCMBQuery *query = [NCMBQuery queryWithClassName:@"HOGEHOGE"];
|
@@ -128,6 +186,12 @@
|
|
128
186
|
|
129
187
|
[query whereKey:@"kaerumsg" notEqualTo:[NSNull null]];
|
130
188
|
|
189
|
+
// [query whereKey:@"water" notEqualTo:[NSNull null]];
|
190
|
+
|
191
|
+
// [query whereKey:@"water" notEqualTo:[NSNull null]];
|
192
|
+
|
193
|
+
// [query orderByAscending:@"kaerumsg"];
|
194
|
+
|
131
195
|
//データストアを検索
|
132
196
|
|
133
197
|
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
|
@@ -148,11 +212,19 @@
|
|
148
212
|
|
149
213
|
for (NCMBObject *object in objects){
|
150
214
|
|
215
|
+
// vals = [object objectForKey:@"kaerumsg"];
|
216
|
+
|
217
|
+
// [self.msgs addObject:vals];
|
218
|
+
|
151
|
-
msgs
|
219
|
+
[_msgs addObject:[object objectForKey:@"kaerumsg"]];
|
220
|
+
|
152
|
-
|
221
|
+
// NSLog(@"%@",vals);
|
222
|
+
|
153
|
-
NSLog(@"%@",msgs);
|
223
|
+
NSLog(@"%@",_msgs);
|
224
|
+
|
154
|
-
|
225
|
+
// [waters addObject:[object objectForKey:@"water"]];
|
226
|
+
|
155
|
-
|
227
|
+
// NSLog(@"%@",waters);
|
156
228
|
|
157
229
|
}
|
158
230
|
|
@@ -216,11 +288,15 @@
|
|
216
288
|
|
217
289
|
cell.msg.numberOfLines = 0;
|
218
290
|
|
219
|
-
|
220
|
-
|
221
|
-
cell.m
|
291
|
+
// cell.amountwater.numberOfLines = 0;
|
222
|
-
|
292
|
+
|
293
|
+
|
294
|
+
|
223
|
-
|
295
|
+
// cell.msg.text = (NSString*)msgs;
|
296
|
+
|
297
|
+
cell.msg.text = _msgs[indexPath.row];
|
298
|
+
|
299
|
+
// cell.amountwater.text = waters[indexPath.row];
|
224
300
|
|
225
301
|
return cell;
|
226
302
|
|
@@ -334,8 +410,6 @@
|
|
334
410
|
|
335
411
|
```
|
336
412
|
|
337
|
-
|
338
|
-
|
339
413
|
### 試したこと
|
340
414
|
|
341
415
|
|
2
文法の修正とコメントを消してプログラムを見やすくしました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -34,6 +34,80 @@
|
|
34
34
|
|
35
35
|
```Objective-C
|
36
36
|
|
37
|
+
#import <Foundation/Foundation.h>
|
38
|
+
|
39
|
+
#import "SecandViewController.h"
|
40
|
+
|
41
|
+
#import "TransitionObj.h"
|
42
|
+
|
43
|
+
#import "givewater.h"
|
44
|
+
|
45
|
+
#import "CustomCell.h"
|
46
|
+
|
47
|
+
#import "NCMB/NCMB.h"
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
@interface SecandViewController ()<UITableViewDataSource, UITableViewDelegate>
|
52
|
+
|
53
|
+
{
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
NSMutableArray *msgs;
|
58
|
+
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
@end
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
// テーブル表示件数
|
68
|
+
|
69
|
+
//const NSInteger historyNumber = 100;
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
@implementation SecandViewController
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
#pragma mark Life Cycle
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
- (void)viewDidLoad {
|
82
|
+
|
83
|
+
[super viewDidLoad];
|
84
|
+
|
85
|
+
// DelegateとDataSourceはstoryboard(またはxib)のところで結び付けるのでもO.K.
|
86
|
+
|
87
|
+
_tblView.delegate = self;
|
88
|
+
|
89
|
+
_tblView.dataSource = self;
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
// カスタムセルを使用
|
94
|
+
|
95
|
+
UINib *nib = [UINib nibWithNibName:@"CustomCell" bundle:nil];
|
96
|
+
|
97
|
+
[_tblView registerNib:nib forCellReuseIdentifier:@"Cell"];
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
//保存したデータの検索と取得
|
102
|
+
|
103
|
+
[self setupData];
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
}
|
108
|
+
|
109
|
+
|
110
|
+
|
37
111
|
//【mBaaS】保存したデータの検索と取得
|
38
112
|
|
39
113
|
|
@@ -46,28 +120,14 @@
|
|
46
120
|
|
47
121
|
NCMBQuery *query = [NCMBQuery queryWithClassName:@"HOGEHOGE"];
|
48
122
|
|
49
|
-
|
50
|
-
|
51
|
-
//日付順にデータを取得
|
52
|
-
|
53
|
-
// [query addDescendingOrder:@"water"];
|
54
|
-
|
55
123
|
// 検索件数を設定
|
56
124
|
|
57
|
-
//query.limit = historyNumber;
|
58
|
-
|
59
|
-
query.limit =
|
125
|
+
query.limit = 20;
|
60
|
-
|
61
|
-
|
126
|
+
|
62
|
-
|
63
|
-
|
127
|
+
|
64
|
-
|
65
|
-
// [query whereKey:@"hikakuleaf" notEqualTo:[NSNull null]];
|
66
128
|
|
67
129
|
[query whereKey:@"kaerumsg" notEqualTo:[NSNull null]];
|
68
130
|
|
69
|
-
// [query whereKey:@"water" notEqualTo:[NSNull null]];
|
70
|
-
|
71
131
|
//データストアを検索
|
72
132
|
|
73
133
|
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {
|
@@ -84,68 +144,24 @@
|
|
84
144
|
|
85
145
|
NSLog(@"検索に成功しました。");
|
86
146
|
|
147
|
+
//[self.msgs removeAllObjects];
|
148
|
+
|
149
|
+
for (NCMBObject *object in objects){
|
150
|
+
|
151
|
+
msgs = [object objectForKey:@"kaerumsg"];
|
152
|
+
|
153
|
+
NSLog(@"%@",msgs);
|
154
|
+
|
87
155
|
|
88
156
|
|
89
|
-
for (NCMBObject *object in objects){
|
90
|
-
|
91
|
-
// _dates = [object objectForKey:@"date"];
|
92
|
-
|
93
|
-
// _damiTemperatures = [object objectForKey:@"damileaf"];
|
94
|
-
|
95
|
-
// _realTemperatures = [object objectForKey:@"hikakuleaf"];
|
96
|
-
|
97
|
-
_msgs = [object objectForKey:@"kaerumsg"];
|
98
|
-
|
99
|
-
// _amountwaters = [object objectForKey:@"water"];
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
//NSLog(@"%@", _dates);
|
104
|
-
|
105
|
-
//NSLog(@"%@", _damiTemperatures);
|
106
|
-
|
107
|
-
// NSLog(@"%@", _realTemperatures);
|
108
|
-
|
109
|
-
// NSLog(@"%@", _msgs);
|
110
|
-
|
111
|
-
NSLog(@"%@", _msgs);
|
112
|
-
|
113
|
-
//型変換を行う
|
114
|
-
|
115
|
-
//NCMBObject *object = objects;
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
// [self.dates addObject: object];
|
120
|
-
|
121
|
-
// self.dates = [object objectForKey:@"date"];
|
122
|
-
|
123
|
-
// self.damiTemperatures = [object objectForKey:@"damileaf"];
|
124
|
-
|
125
|
-
// self.realTemperatures = [object objectForKey:@"hikakuleaf"];
|
126
|
-
|
127
|
-
// self.msgs = [object objectForKey:@"kaerumsg"];
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
// _amountwaters = [object objectForKey:@"water"];
|
132
|
-
|
133
|
-
// 取得したデータをプロパティに代入する
|
134
|
-
|
135
|
-
//self.dataArray = objects;
|
136
|
-
|
137
157
|
}
|
138
158
|
|
139
|
-
|
159
|
+
|
140
160
|
|
141
161
|
}
|
142
162
|
|
143
163
|
|
144
164
|
|
145
|
-
// テーブルビューをリロード
|
146
|
-
|
147
|
-
//[self.tblView reloadData];
|
148
|
-
|
149
165
|
}];
|
150
166
|
|
151
167
|
// **************************************************
|
@@ -174,9 +190,7 @@
|
|
174
190
|
|
175
191
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
176
192
|
|
177
|
-
// return [_msgs count];
|
178
|
-
|
179
|
-
return
|
193
|
+
return 20;
|
180
194
|
|
181
195
|
}
|
182
196
|
|
@@ -198,50 +212,126 @@
|
|
198
212
|
|
199
213
|
CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
|
200
214
|
|
201
|
-
|
202
|
-
|
203
|
-
|
215
|
+
|
204
|
-
|
205
|
-
|
216
|
+
|
206
|
-
|
207
|
-
// cell.realTemperature.numberOfLines = 0;
|
208
|
-
|
209
|
-
|
217
|
+
cell.msg.numberOfLines = 0;
|
210
|
-
|
218
|
+
|
219
|
+
|
220
|
+
|
211
|
-
|
221
|
+
cell.msg.text = (NSString*)msgs;
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
222
|
+
|
216
|
-
|
217
|
-
//cell.imgView.image = [UIImage imageNamed:images[indexPath.row]];
|
218
|
-
|
219
|
-
// 各ラベルにテキストをセット
|
220
|
-
|
221
|
-
//NSString *str = [responseDic objectForKey:@"date"]; //文字データが入ると想定されていたが<null>データが格納された
|
222
|
-
|
223
|
-
// NSString *firstName=[NSString stringWithFormat:@"%@", [[yourArry objectAtIndex:indexPath.row]valueForKey:@"firstName"]];
|
224
|
-
|
225
|
-
// cell.date.text = [NSString stringWithFormat:@"%@",[[_dates objectAtIndex:indexPath.row]valueForKey:@"date"]];
|
226
|
-
|
227
|
-
//cell.
|
223
|
+
//cell.msg.text = (NSString*)msgs[indexPath.row];
|
228
|
-
|
229
|
-
// cell.damiTemperature.text = [NSString stringWithFormat:@"%@",[[_damiTemperatures objectAtIndex:indexPath.row]valueForKey:@"damiTemperature"]];
|
230
|
-
|
231
|
-
cell.msg.text = _msgs[indexPath.row]; //ここでエラーが出ます!!!
|
232
|
-
|
233
|
-
// cell.amountwater.text = [_amountwaters objectAtIndex:indexPath.row];
|
234
|
-
|
235
|
-
// cell.amountwater.text = _amountwaters[indexPath.row];
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
224
|
|
241
225
|
return cell;
|
242
226
|
|
243
227
|
}
|
244
228
|
|
229
|
+
|
230
|
+
|
231
|
+
// セルの高さ設定
|
232
|
+
|
233
|
+
- (CGFloat)tableView:(UITableView*)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
NSLog(@"heightForRowAtIndexPath indexPath:%ld", indexPath.row);
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
//dequeueReusableCellWithIdentifier(セルを使用する)
|
242
|
+
|
243
|
+
CustomCell *Cell = [self.tblView dequeueReusableCellWithIdentifier:@"Cell"];
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
//とりあえず固定値に
|
248
|
+
|
249
|
+
return 200;
|
250
|
+
|
251
|
+
}
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
/**
|
256
|
+
|
257
|
+
* 文字列に必要な高さを計算する処理
|
258
|
+
|
259
|
+
* @param text 文字列
|
260
|
+
|
261
|
+
* @return CGFloat 高さ
|
262
|
+
|
263
|
+
*/
|
264
|
+
|
265
|
+
- (CGFloat)calcHeight:(NSString *)text {
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
// 端末サイズ取得
|
270
|
+
|
271
|
+
CGRect screen = [[UIScreen mainScreen] bounds];
|
272
|
+
|
273
|
+
// 表示する幅 (40 + 8 * 3):画像の幅(40)とマージンの合計(8*3)
|
274
|
+
|
275
|
+
CGFloat width = screen.size.width - (40 + 8 * 3);
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
// 表示する最大幅と高さ
|
280
|
+
|
281
|
+
CGSize maxSize = CGSizeMake(width, CGFLOAT_MAX);
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
// 文字列のフォント種類、サイズなど属性を指定
|
286
|
+
|
287
|
+
NSDictionary *attrDic = @{NSFontAttributeName:[UIFont systemFontOfSize:15.0]};
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
CGRect rect = [text boundingRectWithSize:maxSize
|
292
|
+
|
293
|
+
options:NSStringDrawingUsesLineFragmentOrigin
|
294
|
+
|
295
|
+
attributes:attrDic
|
296
|
+
|
297
|
+
context:nil];
|
298
|
+
|
299
|
+
return rect.size.height;
|
300
|
+
|
301
|
+
}
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
// セル押下時の処理
|
306
|
+
|
307
|
+
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
}
|
312
|
+
|
313
|
+
|
314
|
+
|
315
|
+
#pragma mark Memory
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
- (void)didReceiveMemoryWarning {
|
320
|
+
|
321
|
+
[super didReceiveMemoryWarning];
|
322
|
+
|
323
|
+
// Dispose of any resources that can be recreated.
|
324
|
+
|
325
|
+
}
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
@end
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
|
245
335
|
```
|
246
336
|
|
247
337
|
|
1
プログラムを修正しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,6 +10,8 @@
|
|
10
10
|
|
11
11
|
実行してビルドは通るのですが、セルを表示する画面になるとアプリがクラッシュします。
|
12
12
|
|
13
|
+
(11/10プログラム修正しました)
|
14
|
+
|
13
15
|
|
14
16
|
|
15
17
|
### 発生している問題・エラーメッセージ
|
@@ -20,7 +22,7 @@
|
|
20
22
|
|
21
23
|
クラッシュする際に表示されるエラーメッセージがこちらです。
|
22
24
|
|
23
|
-
|
25
|
+
-[__NSCFString objectAtIndexedSubscript:]: unrecognized selector sent to instance 0x114e12a20
|
24
26
|
|
25
27
|
```
|
26
28
|
|
@@ -48,13 +50,23 @@
|
|
48
50
|
|
49
51
|
//日付順にデータを取得
|
50
52
|
|
51
|
-
[query addDescendingOrder:@"
|
53
|
+
// [query addDescendingOrder:@"water"];
|
52
54
|
|
53
55
|
// 検索件数を設定
|
54
56
|
|
55
57
|
//query.limit = historyNumber;
|
56
58
|
|
57
|
-
|
59
|
+
query.limit = 5;
|
60
|
+
|
61
|
+
// [query whereKey:@"date" notEqualTo:[NSNull null]];
|
62
|
+
|
63
|
+
// [query whereKey:@"damileaf" notEqualTo:[NSNull null]];
|
64
|
+
|
65
|
+
// [query whereKey:@"hikakuleaf" notEqualTo:[NSNull null]];
|
66
|
+
|
67
|
+
[query whereKey:@"kaerumsg" notEqualTo:[NSNull null]];
|
68
|
+
|
69
|
+
// [query whereKey:@"water" notEqualTo:[NSNull null]];
|
58
70
|
|
59
71
|
//データストアを検索
|
60
72
|
|
@@ -72,39 +84,75 @@
|
|
72
84
|
|
73
85
|
NSLog(@"検索に成功しました。");
|
74
86
|
|
75
|
-
|
76
|
-
|
87
|
+
|
88
|
+
|
77
|
-
|
89
|
+
for (NCMBObject *object in objects){
|
90
|
+
|
78
|
-
|
91
|
+
// _dates = [object objectForKey:@"date"];
|
92
|
+
|
93
|
+
// _damiTemperatures = [object objectForKey:@"damileaf"];
|
94
|
+
|
95
|
+
// _realTemperatures = [object objectForKey:@"hikakuleaf"];
|
96
|
+
|
97
|
+
_msgs = [object objectForKey:@"kaerumsg"];
|
98
|
+
|
99
|
+
// _amountwaters = [object objectForKey:@"water"];
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
//NSLog(@"%@", _dates);
|
104
|
+
|
105
|
+
//NSLog(@"%@", _damiTemperatures);
|
106
|
+
|
107
|
+
// NSLog(@"%@", _realTemperatures);
|
108
|
+
|
109
|
+
// NSLog(@"%@", _msgs);
|
110
|
+
|
111
|
+
NSLog(@"%@", _msgs);
|
112
|
+
|
79
|
-
//型変換を行う
|
113
|
+
//型変換を行う
|
80
|
-
|
114
|
+
|
81
|
-
NCMBObject *object =
|
115
|
+
//NCMBObject *object = objects;
|
116
|
+
|
117
|
+
|
118
|
+
|
82
|
-
|
119
|
+
// [self.dates addObject: object];
|
120
|
+
|
83
|
-
self.dates = [object objectForKey:@"date"];
|
121
|
+
// self.dates = [object objectForKey:@"date"];
|
84
|
-
|
122
|
+
|
85
|
-
self.damiTemperatures = [object objectForKey:@"damileaf"];
|
123
|
+
// self.damiTemperatures = [object objectForKey:@"damileaf"];
|
86
|
-
|
124
|
+
|
87
|
-
self.realTemperatures = [object objectForKey:@"hikakuleaf"];
|
125
|
+
// self.realTemperatures = [object objectForKey:@"hikakuleaf"];
|
88
|
-
|
126
|
+
|
89
|
-
self.msgs = [object objectForKey:@"kaerumsg"];
|
127
|
+
// self.msgs = [object objectForKey:@"kaerumsg"];
|
90
|
-
|
128
|
+
|
129
|
+
|
130
|
+
|
91
|
-
|
131
|
+
// _amountwaters = [object objectForKey:@"water"];
|
92
|
-
|
132
|
+
|
93
|
-
//
|
133
|
+
// 取得したデータをプロパティに代入する
|
94
|
-
|
134
|
+
|
95
|
-
|
135
|
+
//self.dataArray = objects;
|
96
136
|
|
97
137
|
}
|
98
138
|
|
139
|
+
|
140
|
+
|
141
|
+
}
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
// テーブルビューをリロード
|
146
|
+
|
147
|
+
//[self.tblView reloadData];
|
148
|
+
|
99
149
|
}];
|
100
150
|
|
101
151
|
// **************************************************
|
102
152
|
|
103
|
-
//
|
153
|
+
//
|
104
|
-
|
154
|
+
|
105
|
-
}
|
155
|
+
}
|
106
|
-
|
107
|
-
|
108
156
|
|
109
157
|
|
110
158
|
|
@@ -126,9 +174,9 @@
|
|
126
174
|
|
127
175
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
128
176
|
|
129
|
-
return [_dates count];
|
130
|
-
|
131
|
-
|
177
|
+
// return [_msgs count];
|
178
|
+
|
179
|
+
return 5;
|
132
180
|
|
133
181
|
}
|
134
182
|
|
@@ -152,15 +200,15 @@
|
|
152
200
|
|
153
201
|
|
154
202
|
|
155
|
-
cell.date.numberOfLines = 0;
|
203
|
+
// cell.date.numberOfLines = 0;
|
156
|
-
|
204
|
+
|
157
|
-
cell.damiTemperature.numberOfLines = 0;
|
205
|
+
// cell.damiTemperature.numberOfLines = 0;
|
158
|
-
|
206
|
+
|
159
|
-
cell.realTemperature.numberOfLines = 0;
|
207
|
+
// cell.realTemperature.numberOfLines = 0;
|
160
|
-
|
208
|
+
|
161
|
-
cell.msg.numberOfLines = 0;
|
209
|
+
cell.msg.numberOfLines = 0;
|
162
|
-
|
210
|
+
|
163
|
-
cell.amountwater.numberOfLines = 0;
|
211
|
+
// cell.amountwater.numberOfLines = 0;
|
164
212
|
|
165
213
|
|
166
214
|
|
@@ -170,15 +218,23 @@
|
|
170
218
|
|
171
219
|
// 各ラベルにテキストをセット
|
172
220
|
|
221
|
+
//NSString *str = [responseDic objectForKey:@"date"]; //文字データが入ると想定されていたが<null>データが格納された
|
222
|
+
|
223
|
+
// NSString *firstName=[NSString stringWithFormat:@"%@", [[yourArry objectAtIndex:indexPath.row]valueForKey:@"firstName"]];
|
224
|
+
|
225
|
+
// cell.date.text = [NSString stringWithFormat:@"%@",[[_dates objectAtIndex:indexPath.row]valueForKey:@"date"]];
|
226
|
+
|
173
|
-
cell.date.text =
|
227
|
+
//cell.date.text =[_dates objectAtIndex:indexPath.row];
|
174
|
-
|
228
|
+
|
175
|
-
cell.damiTemperature.text = s
|
229
|
+
// cell.damiTemperature.text = [NSString stringWithFormat:@"%@",[[_damiTemperatures objectAtIndex:indexPath.row]valueForKey:@"damiTemperature"]];
|
176
|
-
|
177
|
-
|
230
|
+
|
178
|
-
|
179
|
-
cell.msg.text =
|
231
|
+
cell.msg.text = _msgs[indexPath.row]; //ここでエラーが出ます!!!
|
232
|
+
|
180
|
-
|
233
|
+
// cell.amountwater.text = [_amountwaters objectAtIndex:indexPath.row];
|
234
|
+
|
181
|
-
cell.amountwater.text =
|
235
|
+
// cell.amountwater.text = _amountwaters[indexPath.row];
|
236
|
+
|
237
|
+
|
182
238
|
|
183
239
|
|
184
240
|
|
@@ -186,8 +242,6 @@
|
|
186
242
|
|
187
243
|
}
|
188
244
|
|
189
|
-
|
190
|
-
|
191
245
|
```
|
192
246
|
|
193
247
|
|
@@ -198,7 +252,7 @@
|
|
198
252
|
|
199
253
|
NSLogを用いてデータが検索できているかどうか調べましたが、mBassからの検索はできています。
|
200
254
|
|
201
|
-
おそらくデータを配列に入れるところで間違っていると思いますので、どなたかご指摘よろしくお願いします。
|
255
|
+
おそらくデータを配列に入れてテキストに表示させるところで間違っていると思いますので、どなたかご指摘よろしくお願いします。
|
202
256
|
|
203
257
|
|
204
258
|
|