1

这是我的代码,我创建了一组图像,通过修饰图像将其引导至另一个页面。我得到了图像的封面,但无法为图像设置操作。有人可以帮忙吗?...

[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"];
}

在这里,我按照以下链接教程获取封面流.. http://blog.objectgraph.com/index.php/2010/04/09/how-to-add-coverflow-effect-on-your-iphone-应用程序-openflow/

4

2 回答 2

1

编辑:

如果您需要一种方法来对点击图像做出反应,请查看我为 AFOpenFlow 制作的这个 fork。您将看到一个新类 ,SDSOpenFlowView它派生自AFOpenFlow,以及一个SDSOpenFlowViewDelegate扩展原始委托协议的类。它还支持图像的抖动和长按。

旧答案:

为您的封面流视图设置一个委托,例如。如果您在控制器内部执行此操作并让您的控制器成为委托:

coverFlowView.delegate = self;

然后定义这个方法

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

在您的控制器中:当用户选择不同的页面时将调用它。

于 2012-06-15T11:39:28.310 回答
1

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

您已经在 AFOpenFlowView.m 中有这个事件(甚至是 touchesEnded),只需对其进行自定义并做必要的事情。

如果您遇到任何问题,请发表评论。

于 2012-06-15T12:07:01.807 回答