我可以从网络服务器的 XML 文件中检索图像并将图像列为 ScrollView 。现在我想单击一个图像,该图像应将我带到另一个窗口,该窗口应再次显示一些图像作为 Collection View 。谁能建议我如何做到这一点。
我列出了我的 TableView Controller 和我需要的现有引用图像。
MyTableViewController.m
- (void)viewDidLoad{
[super viewDidLoad];
xmlParser = [[egsXMLParser alloc] loadXMLByURL:@"http://retrieveurlxml.com/sample.xml"];
[self.tableView reloadData];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"myimages";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
} UIImage *currentTweet = [[xmlParser tweets] objectAtIndex:indexPath.row];
UIImageView *tweetImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0,0,cell.frame.size.width , cell.frame.size.height)];
tweetImageView.image = currentTweet;
[cell setBackgroundView:tweetImageView];
return cell;
}
我当前的 ScrollView 如下所示,
我需要的是如下所示,
任何人都可以建议我如何实现这样的目标。
最佳答案
只需使用我通过电子邮件发送给您的 API。要调用此 API:
ASyncImage *img_EventImag = alloc with frame;
NSURL *url = yourURL;
[img_EventImage loadImageFromURL:url];
[self.view addSubView:img_EventImage]; // In your case you'll add in your TableViewCell.
关于iphone - 如何在 ScrollView 中显示图像列表,其中图像是从 iPhone 中的 URL XML 文件中检索的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14557405/