サービスを呼び出すときにName、Country、Idの下に次のレスポンスでテーブルビューを読み込みました。ロード後、Objective-Cで他のサービスを呼び出すことで、tableviewセルのテキストの値を変更します。
(
{
Name = David;
Country = USA
Id = 100;
},
{
Name = Mike;
Id = 101;
Country = Australia
},
{
Name = John;
Id = 102;
Country = UK
}
)
私はtabview footerにボタンがあります。ボタンが押されたときに、テーブルビュー内の名前だけを交換するサービスを呼び出すが、国とIDは入れ替えないと、ボタンを押したときのレスポンスは以下のようになります。
(
{
Name = Phillip;
Id = 200;
},
{
Name = Jackman;
Id = 201;
},
{
Name = Arrow;
Id = 202;
}
)
以下は私が試みたものです。しかし
- (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
CartItemCell *cell = (CartItemCell *) [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"CartItemCell" owner:self options:nil];
for (id currentObject in topLevelObjects){
if ([currentObject isKindOfClass:[UITableViewCell class]]){
cell = (CartItemCell *) currentObject;
cell.backgroundColor=[UIColor clearColor];
}
}
}
NSMutableDictionary *detailsdict=[cartArray objectAtIndex:indexPath.row];
cell.lblName.text = [detailsdict objectForKey:@"Name"];
cell.lblCountry.text = [detailsdict objectForKey:@"Country"];
cell.lblId.text = [detailsdict objectForKey:@"Id"];
cell.selectionStyle=UITableViewCellSelectionStyleNone;
return cell;
}
名前を交換することはできませんあなたはボタンが押された時には、次のコードを使用して、私はthis.TIA
さらに詳しい情報をご提供ください。 –
あなたは何を試しましたか? – Himanth