尝试这个
[self performSelectorInBackground:@selector(downloadImage_3:AtIndex:) withObject:[NSArray arrayWithObjects:@"http://www.google.com",i, nil] afterDelay:15.0];
或者试试这个
NSString* number = [NSString stringWithFormat:@"%d",i];
NSArray* arrayValues = [[NSArray alloc] initWithObjects:[[msg_array objectAtIndex:i] valueForKey:@"Merchant_SmallImage"],number, nil];
NSArray* arrayKeys = [[NSArray alloc] initWithObjects:@"Path",@"Index",nil];
NSDictionary* dic = [[NSDictionary alloc] initWithObjects:arrayValues forKeys:arrayKeys];
[self performSelectorInBackground:@selector(downloadImage_3:) withObject:dic];
像这样定义 downloadImage_3 函数:
-(void)downloadImage_3:(NSDictionary *)dic
{
NSString *path = [dic valueForKey:@"Path"];
int i = [[dic valueForKey:@"Index"] intValue];
//Your code
}