/ Published in: Objective C
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/*------------------------------------------------------------- * DECLORATION *------------------------------------------------------------*/ NSMutableDictionary *receivedData; /*------------------------------------------------------------- * IMPLEMENTATION *------------------------------------------------------------*/ CustomURLConnection *connection = [[CustomURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES tag:tag]; if (connection) { } } return data; } - (void)load { [self startAsyncLoad:url1 tag:@"tag1"]; [self startAsyncLoad:url2 tag:@"tag2"]; [self startAsyncLoad:url3 tag:@"tag3"]; } [dataForConnection setLength:0]; } [dataForConnection appendData:data]; } [connection release]; // Do something with the dataForConnection. } /*------------------------------------------------------------- * CUSTOM NSURLCONNECTION CLASS *------------------------------------------------------------*/ NSString *tag; } - (id)initWithRequest:(NSURLRequest *)request delegate:(id)delegate startImmediately:(BOOL)startImmediately tag:(NSString*)tag; @end /*------------------------------------------------------------- * IMPLEMENTATION *------------------------------------------------------------*/ @implementation CustomURLConnection @synthesize tag; - (id)initWithRequest:(NSURLRequest *)request delegate:(id)delegate startImmediately:(BOOL)startImmediately tag:(NSString*)tag { self = [super initWithRequest:request delegate:delegate startImmediately:startImmediately]; if (self) { self.tag = tag; } return self; } - (void)dealloc { [tag release]; [super dealloc]; } @end