views:

48

answers:

1

Hi,

In my app I have connections with a web service and I would like to create a loading view to show each time the connection starts until it returns a response.

Where is the best place to put this view in my application and what is the best way to implement it?

Thanks,

Fermin

A: 

NSURL *url = [NSURL URLWithString:@"http://.....?WSDL"];

NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];

NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]];

[theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];

[theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];

[theRequest setHTTPMethod:@"POST"];

[theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]]; 

NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];

[theConnection start];

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{

[webData appendData:data];

}

If you click on "edit" under your question, you can add your code into your question.
Perspx
Thank you Perspx