我通过使用openflow库http://apparentlogic.com/openflow/实现了iphone的coverflow,其中我将服务器中的图像分配到coverflow ..它工作正常,但它不包含导航到下一个视图的方法。 你们可以帮我解决一下如何在图像上添加一个按钮..或者有图像点击的任何委托方法......下面是代码
@implementation cfDemoViewController
@synthesize arX = _arX;
- (void)dealloc
{
[super dealloc];
[_arX release];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
- (void)viewDidLoad
{
[super viewDidLoad];
ar=[NSArray arrayWithObjects:@"http://www.maiepiccreations.com/wp-content/uploads/2011/06/art-off-255x255.jpg",
@"http://www.estudiogold.net/wp-content/uploads/2010/03/Alpha-Dista-Icon-29.png",
@"http://muraltech.com/gallery/album/thumbsm/window-pane-art.jpg",
@"http://www.foreman.ubishops.ca/fileadmin/foreman_documents/images/exhibitions/2005-2006/time2/aboveandbelow.jpg",
@"http://www.neo-art.co.uk/1150neo.jpg",
@"http://flowfineart.com/images/nov07/art-bettina1.jpg",nil];
self.arX=ar;
queue=[[ASINetworkQueue alloc] init];
for (int i=0; i < [ar count]; i++) {
[(AFOpenFlowView *)self.view setImage:[UIImage imageNamed:@"default.png"] forIndex:i];
}
[self requestForImage:0];
[(AFOpenFlowView *)self.view setNumberOfImages:[ar count]];
}
-(void)requestForImage:(NSUInteger)index{
if(index>=[self.arX count])
return;
ASIHTTPRequest *req=[ASIHTTPRequest requestWithURL:[NSURL URLWithString:[self.arX objectAtIndex:index]]];
[req setDidFinishSelector:@selector(requestDone:)];
[req setUsername:[NSString stringWithFormat:@"%i",index]];
[req setDelegate:self];
[queue addOperation:req];
[queue go];
}
- (void)requestDone:(ASIHTTPRequest *)request
{
NSUInteger index=[[request username] intValue];
UIImage *img=[UIImage imageWithData:[request responseData]];
img=[img cropCenterAndScaleImageToSize:CGSizeMake(225, 225)];
[(AFOpenFlowView*)self.view setImage:img forIndex:index];
[self requestForImage:index+1];
}