0

Web サービスを使用してデータを削除するにはどうすればよいですか?

私はUILabelのようuiOidに持っていCustomTableviewCell.hます。今、私はViewController.m のように使用uiOidしています。cell.uiOid.text=[orid objectAtIndex:indexPath.row];これoridNSMutablearray、Web サービスからレコードを取得するためのものです。データを正しく取得しましたが、問題はどうすれば削除できますか? Webサービスを使用してデータを削除しています。

私はdelete webserviceを挿入しました

//更新しました//

- (void)tableView:(UITableView *)aTableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete)
  {      
    [desc removeObjectAtIndex:indexPath.row];
    [item removeObjectAtIndex:indexPath.row];
    [cpack removeObjectAtIndex:indexPath.row];
    [uprice removeObjectAtIndex:indexPath.row];
    [cprice removeObjectAtIndex:indexPath.row];
    [quantity removeObjectAtIndex:indexPath.row];
    [total removeObjectAtIndex:indexPath.row];
    [orid removeObjectAtIndex:indexPath.row];


    NSLog(@"%@",[uid objectForKey:@"OID"]);
    NSLog(@"%@",orid);


    NSString *soapmessage = [NSString stringWithFormat:
                             @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
                             "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n"
                             "<soap:Body>\n"
                             "<DeleteValue xmlns=\"http://tempuri.org/\">\n"
                             "<oid>%@</oid>"
                             "</DeleteValue>\n"
                             "</soap:Body>\n"
                             "</soap:Envelope>\n",orid

                             ];

    NSLog(@"%@",soapmessage);

    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@",appdev.hostname]];
    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
    NSString *msgLength = [NSString stringWithFormat:@"%d", [soapmessage length]];

    [theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
    [theRequest addValue: @"http://tempuri.org/DeleteVaue" forHTTPHeaderField:@"SOAPAction"];
    [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
    [theRequest setHTTPMethod:@"POST"];
    [theRequest setHTTPBody: [soapmessage dataUsingEncoding:NSUTF8StringEncoding]];

}

[mytableview reloadData];

}

方法。静的番号「89291」を入力すると、データが正常に削除されました(複数操作には役立ちません)。orid (NSMutableArray)しかし、静的番号の代わりに webserviceを渡したいです。どうすればこれを修正できますか? 助けてくれてありがとう。

4

2 に答える 2

0

これを削除サービス メソッドに渡します。

[orid objectAtIndex:indexPath.row];

テーブルから行が削除されるたびに実行されます。その後:

[orid removeObjectAtIndex:indexPath.row];
[aTableView reloadData];
于 2013-07-26T11:26:05.330 に答える