NSURLConnection 代理

@interfaceDownloadDelegate:NSObject

-(void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse*)response;

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

@end

 

@implementationDownloadDelegate

-(void)connection:(NSURLConnection*)connection didReceiveResponse:(NSURLResponse*)response {

}

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

}

@end

We use the delegate like so:

 

DownloadDelegate*dd =[DownloadDelegate alloc];

NSURLConnection*c2 =[[NSURLConnection alloc] initWithRequest:url delegate:dd];

posted on 2011-08-30 21:41  风乔  阅读(171)  评论(0编辑  收藏  举报

导航