我已经使用http://chaosinmotion.com/flowcover.m这个链接实现了coverFlow。它工作得很好。我想通过web服务获得coverFlow图像。它可以很好地处理单个图像。任何人给我代码获得多个coverFlow图像在一个单一的网址有多个图像attributes.Any在后端的变化应该反映在代码手段,如果没有图像增加,那么在coverflow也显示相同的否。图像的数量。
发布于 2012-07-10 16:14:20
在CoverFlowViewController.h文件中
NSMutableArray *profilephotos; // declare NSMutableArray在CoverFlowViewController.m文件中
- (void)viewDidLoad
{
profilephotos = [[NSMutableArray alloc] initWithObjects:@"www.xxxx.com/ima.jpeg",@"www.xxxx.com/ima1.jpeg",@"www.xxxx.com/ima2.jpeg",@"www.xxxx.com/ima3.jpeg",@"www.xxxx.com/ima4.jpeg",@"www.yyy.com/ima5.jpeg",nil];
NSLog(@"profilephotos = %@",profilephotos); // Your array of Images url
loadImagesOperationQueue = [[NSOperationQueue alloc] init];
for (int i=0; i < [profilephotos count]; i++)
{
NSString *pho = [profilephotos objectAtIndex:i];
NSURL *url = [NSURL URLWithString:pho];
NSData *data = [NSData dataWithContentsOfURL: url];
UIImage *img=[UIImage imageWithData:data];
CGSize newSize = CGSizeMake(300.0f, 300.0f);
UIGraphicsBeginImageContext(newSize);
[img drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[(AFOpenFlowView *)self.view setImage:newImage forIndex:i];
}
[(AFOpenFlowView *)self.view setNumberOfImages:[profilephotos count]];
}https://stackoverflow.com/questions/11409011
复制相似问题