(
(
"http://sportsromio.aiminfotechs.com/WEBSERVICES/available_sports/volleyball.png",
"http://sportsromio.aiminfotechs.com/WEBSERVICES/available_sports/football.png"
),
(
"http://sportsromio.aiminfotechs.com/WEBSERVICES/available_sports/football.png",
"http://sportsromio.aiminfotechs.com/WEBSERVICES/available_sports/cricket.png"
)
我使用这个数组我该如何使用它。
答案 0 :(得分:1)
将此代码放入'cellForRowIndexPath'
int x = 0;
for (NSURL * url in yourArrayName) {
UIImageView *yourImageView =[[UIImageView alloc] initWithFrame:CGRectMake(x,50,20,20)];
yourImageView.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:url]];
[cell addSubview:yourImageView];
x = x + 60;
}
答案 1 :(得分:0)
为行添加单元格
int x = 0;
for (NSString * stringurl in [imgs objectAtIndex:indexPath.row]) {
UIImageView *yourImageView =[[UIImageView alloc] initWithFrame:CGRectMake(x,10,40,40)];
NSURL *url=[NSURL URLWithString:stringurl];
__block UIActivityIndicatorView *activityIndicator;
__weak UIImageView *weakImageView = yourImageView;
[yourImageView sd_setImageWithURL:url
placeholderImage:[UIImage imageNamed:@"placeholder"]
options:SDWebImageProgressiveDownload
progress:^(NSInteger receivedSize, NSInteger expectedSize) {
if (!activityIndicator) {
[weakImageView addSubview:activityIndicator = [UIActivityIndicatorView.alloc initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]];
activityIndicator.center = weakImageView.center;
[activityIndicator startAnimating];
}
}
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
[activityIndicator removeFromSuperview];
activityIndicator = nil;
}];
[cell addSubview:yourImageView];
x = x + 40;
}