質問があります。URL から JSON を取得すると、次のようになります。
- (NSMutableArray *)parseObject:(NSString *)object withKey:(NSInteger)key {
NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults];
NSString *randomKey = [standardUserDefaults stringForKey:@"randomKey"];
NSString *urlString = [NSString stringWithFormat:@"http://domain.com"];
NSURL *url = [NSURL URLWithString:urlString];
NSData *data = [NSData dataWithContentsOfURL:url];
NSError *error;
NSMutableDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
NSArray* latestLoans = [json objectForKey:@"object"];
NSDictionary* loan = [latestLoans objectAtIndex:key];
NSArray *myWords = [[loan objectForKey:object] componentsSeparatedByString:@","];
return myWords;
}
私のTableViewへ
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = [[self parseObject:@"bedrijfsnaam" withKey:0] objectAtIndex:indexPath.row];
//cell.detailTextLabel.text = [[self parseObject:@"leverunix" withKey:0] objectAtIndex:indexPath.row];
cell.textLabel.font = [UIFont systemFontOfSize:14.0];
cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
cell.textLabel.numberOfLines = 3;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
ロードが非常に遅く、スクロールしたいときに一種のラグがあります。これを改善するにはどうすればよいですか?
ありがとう