Vishnu
Vishnu

Reputation: 2243

How to set action for UIimage which is in coverflow?

Here is my code which i created array of images where it leads to another page by touching up an image..I got the coverflow of images but cant set action for image..can anyone help?...

[super viewDidLoad];

loadImagesOperationQueue = [[NSOperationQueue alloc] init];
NSString *imageName;

for (int i=0; i<10; i++) {
    imageName = [[NSString alloc] initWithFormat:@"cover_%d.jpg", i];

    [(AFOpenFlowView *)self.view setImage:[UIImage imageNamed:imageName] forIndex:i];
    [imageName release];
    NSLog(@"%d is the index",i);

}
[(AFOpenFlowView *)self.view setNumberOfImages:10];

- (UIImage *)defaultImage{

return [UIImage imageNamed:@"cover_1.jpg"];
}

here i've followed the following link tutorial to get coverflow.. http://blog.objectgraph.com/index.php/2010/04/09/how-to-add-coverflow-effect-on-your-iphone-app-openflow/

Upvotes: 1

Views: 503

Answers (2)

Naina Soni
Naina Soni

Reputation: 720

Find - https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/AFOpenFlow/AFOpenFlowView.m

You already have this event (touchesEnded even) in AFOpenFlowView.m, just customize it and do the needful.

Post comment if you face any issue.

Upvotes: 1

sergio
sergio

Reputation: 69027

EDIT:

if you need a way to react upon a tap on an image, then have a look at this fork I made to AFOpenFlow. You will see a new class, SDSOpenFlowView, which derives from AFOpenFlow, and a SDSOpenFlowViewDelegate which extends the original delegate protocol. It also supports shaking of the images and long pressure.

OLD ANSWER:

Set a delegate for your cover flow view, eg. if you do that inside of your controller and let your controller be the delegate:

coverFlowView.delegate = self;

then define this method

- (void)openFlowView:(AFOpenFlowView *)openFlowView selectionDidChange:(int)index;

in your controller: it will be called when the user selects a different page.

Upvotes: 1

Related Questions