1
我使用openflow庫http://apparentlogic.com/openflow/實現了iPhone的coverflow,其中我將圖像從服務器分配到coverflow ..它工作正常,但它不包含導航到下一個視圖的方法。 可以ü人幫助我如何將按鈕添加到image..or是有圖像點擊任何委託方法...以下是代碼如何使用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];
}
感謝mkay會試一試... – kingston