0
我很新的iPhone开发。我试图实现滚动视图与动态从网页加载图像。我试图使用下面的代码。我怎样才能动态滚动图像
for (counter = 0; counter < 2; counter++) {
RSSEntry *entry = [_allEntries objectAtIndex:counter];
NSData * imageData = [[NSData alloc] initWithContentsOfURL: [NSURL URLWithString: entry.articleUrl]];
UIImage *img = [UIImage imageWithData: imageData];
NSLog(@"%@", entry.articleUrl);
UIImageView *imageView = [[UIImageView alloc] initWithImage:img];
[imageData release];
CGRect rect = scrollViewController.frame;
imageView.frame = rect;
imageView.tag = (counter + 1); // tag our images for later use when we place them in serial fashion
[scrollViewController addSubview:imageView];
[imageView release];
}
这些是我加载在viewDidLoad
上的两幅图像。我想在用户滚动到第二张图片时加载下一张图片,并且如果用户滚动接下来要显示图像正在加载。任何建议?
'TCImageView'刚刚更新并重命名为'TCWebImageView':https://github.com/totocaster/TCWebImageView –