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 –