gpt4 book ai didi

iphone - 如何为 coverflow 中的 UIimage 设置 Action ?

转载 作者:行者123 更新时间:2023-11-29 11:12:06 27 4
gpt4 key购买 nike

这是我的代码,我创建了图像数组,它通过触摸图像引导到另一个页面..我得到了图像的封面流,但无法为图像设置 Action ..任何人都可以帮忙吗?...

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

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

最佳答案

编辑:

如果您需要一种在点击图像时使用react的方法,请查看 this fork I made to AFOpenFlow .您将看到一个新类 SDSOpenFlowView,它派生自 AFOpenFlow,以及一个扩展原始委托(delegate)协议(protocol)的 SDSOpenFlowViewDelegate。它还支持图像的抖动和长压。

旧答案:

为您的封面流 View 设置委托(delegate),例如。如果您在 Controller 内部执行此操作并让您的 Controller 成为委托(delegate):

coverFlowView.delegate = self;

然后定义这个方法

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

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

关于iphone - 如何为 coverflow 中的 UIimage 设置 Action ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11049941/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com