for (int i=0 ; i<ScrollViewArr.count; i++) {
UIButton *button = [UIButtonbuttonWithType:UIButtonTypeCustom];
button.frame =CGRectMake(10+i*(width +10 ),10, width, width);
NSString *sitemCode = [[ScrollViewArrobjectAtIndex:i] objectForKey:@"sitemCode"];
NSString *contsFileNm = [NSStringstringWithFormat:@"%@L.jpg",sitemCode];
NSString *strUrl = [NSStringstringWithFormat:@"http://image1.oshishang.cn/%@%@", [[ScrollViewArrobjectAtIndex:i] objectForKey:@"contsPathNm"],contsFileNm];
NSURL *URL = [NSURLURLWithString:strUrl];
dispatch_queue_t xrQueue =dispatch_queue_create("loadImage",NULL);
dispatch_async(xrQueue, ^{
UIImage *img = [UIImageimageWithData:[NSDatadataWithContentsOfURL:URL]];
dispatch_async(dispatch_get_main_queue(), ^{
[button setImage:imgforState:UIControlStateNormal];
});
});
[BrandScrollViewaddSubview:button];
}
BrandScrollView.contentSize =CGSizeMake((ScrollViewArr.count * width)+((ScrollViewArr.count+1) * 10), 100);
}