1 つの tableView に 2 つの異なる配列を表示しようとしています。「years」配列を文字列として宣言し、「mount」配列を整数として宣言しました。年数 例: 2012, 2013 .... 155888, 151768 アプリケーションを build7run すると、結果は次のようになります: (数字が 16 ずつ減っているように見えます)
Remaining Amount On
2012: 80912864
2013: 79047056
2014: 79046640
2015: 79046640
2016: 79051632
...
2020: 80928544
「年」配列は文字列として機能しますが、「金額」である整数配列は機能しません。cell.text= 行で整数の書式設定を行っていることは間違いありません。この問題の解決に役立てていただければ幸いです よろしくお願いします
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"remainingAmountOn";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
NSUInteger row = [indexPath row];
**cell.text =** [NSString stringWithFormat:@"%@ %d", [years objectAtIndex:row],
[NSNumber numberWithInt:[amount objectAtIndex:row]]];
return cell;
}