http://chaosinmotion.com/flowcover.mこのリンクを使用して coverFlow を実装しました。その正常に動作します。Web サービスを介して coverFlow 画像を取得したいと考えています。単一の画像では正常に機能します。複数の画像属性を持つ単一の URL で複数の coverFlow 画像を取得するためのコードを送ってください。画像の。
1 に答える
0
In CoverFlowViewController.h file
NSMutableArray *profilephotos; // declare NSMutableArray
In CoverFlowViewController.m file
- (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]];
}
于 2012-07-10T08:14:19.823 に答える