2017-03-23 2 views
0
-(UITableViewCell *)tableView:(UITableView *)tableViewcellForRowAtIndexPath:(NSIndexPath *)indexPath{static NSString *cellIdentifier = @"Cell"; 
    customcell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; 
    if (!cell) { 
     cell = [[customcell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; 
    } 
    cell.finacialyear.text=[self->entries1 objectAtIndex:indexPath.row]; 
    cell.term.text=[self->entries2 objectAtIndex:indexPath.row]; 
    cell.balance.text=[self->entries3 objectAtIndex:indexPath.row]; 
    cell.tintColor = [UIColor blueColor]; 
    return cell; 
} 

テーブルビューのセルに行の値を追加して、最後の行に表示する必要があります。客観的なcでこれを行う。uitableviewの行の値を追加し、目的のcを使用してuitableviewの最終行に追加値を表示

おかげ

答えて

0

最初に使用すると、1つの余分な行を追加する必要があります:あなたが最後の行にある場合

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 
    return <#rows you have now#> + 1; 
} 

その後、別のセルを返す必要があります:

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 
    if (isLastRow) { 
     return BalanceSumCell; 
    } else { 
     return customcell; 
    } 
} 

は名前に覚えておいてくださいあなたのクラスは大文字の最初の手紙(CustomCellで、customcellではありません)。一般的に

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 
    // Keep track of user's selection and update the last cell as needed 
} 

、あなたの質問が広い、あなたは小さな問題にそれを打破する場合は、以下となります。

ユーザーがセルを選択したときに別の計算を行いたい場合は、-didSelectRowAtIndexPathでいることを行う必要がありますあなたに役立つ多くの関連する回答を見つけてください。

幸運を祈る!