NSMutableData appendData
- (void)appendData:(NSData *)otherData
Parameters of [NSMutableData appendData]
otherData
The data object whose content is to be appended to the contents of the receiver.
NSMutableData appendData example.
self.globalData = [[NSMutableData alloc] init];
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
[self.globalData appendData:data];
float progress = (float)[self.globalData length] / self.downloadSize;
self.threadProgressView.progress = progress;
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
[self.globalData appendData:data];
float progress = (float)[self.globalData length] / self.downloadSize;
self.threadProgressView.progress = progress;
}
Example of [NSMutableData appendData].
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
if(!receivedData)
{
receivedData = [NSMutableData data];
}
[receivedData appendData:data];
}
{
if(!receivedData)
{
receivedData = [NSMutableData data];
}
[receivedData appendData:data];
}
NSMutableData appendData example.
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
NSMutableData *currentData = (NSMutableData*)[receivedData objectForKey:[connection description]];
[currentData.appendData:data];
}
{
NSMutableData *currentData = (NSMutableData*)[receivedData objectForKey:[connection description]];
[currentData.appendData:data];
}