打开图像视图 点击封面流程

发布于 2024-11-10 04:47:48 字数 95 浏览 3 评论 0原文

我在我的项目中使用封面流库。我的封面流由许多图像组成。我想要做的是,当我单击该图像时,另一个视图控制器应该打开。 请告诉我如何打开该图像单击的另一个视图。 任何帮助将不胜感激。

I am using cover flow library in my project.My cover flow consist of many images.What I want to do is when I click on that image another View Controller should gets open.
Please tell me how to open another view on that image click.
Any help will be highly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

爱人如己 2024-11-17 04:47:48

我昨天也遇到了同样的问题。我必须改变框架中的一些东西。
在界面中添加这两个方法

@interface AFOpenFlowView : UIView
- (AFItemView *)selectedCoverView;
- (UIScrollView *)scrollView;

在 .m 文件中添加这两个方法的实现

@implementation AFOpenFlowView

- (AFItemView *)selectedCoverView {
return selectedCoverView;
}

- (UIScrollView *)scrollView {
return scrollView;
}

在使用 AFOpenFlowView 的视图控制器中设置 UITapGestureRecognizer

- (void)viewDidLoad {
[super viewDidLoad];

UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(screenTapped:)];
[[self view] addGestureRecognizer:tapRecognizer];
[tapRecognizer release];
}

最后实现处理屏幕上的点击的方法

- (void)screenTapped:(UITapGestureRecognizer *)tap {

CGPoint point = [tap locationInView:[af scrollView]];

if (CGRectContainsPoint([[af selectedCoverView] frame], point)) {
            // Write here the code to open your view
            // Use [af selectedCoverView].number to get the index of the selected cover
    NSLog(@"selected cover view: %d", [af selectedCoverView].number);
}

}

希望它能成功为您节省一些时间! ;)

I had the same problem yesterday. I had to change something in the framework.
Add these two methods in the interface

@interface AFOpenFlowView : UIView
- (AFItemView *)selectedCoverView;
- (UIScrollView *)scrollView;

Add the implementations of these two methods inside of the .m file

@implementation AFOpenFlowView

- (AFItemView *)selectedCoverView {
return selectedCoverView;
}

- (UIScrollView *)scrollView {
return scrollView;
}

Set a UITapGestureRecognizer in the view controller where you're using the AFOpenFlowView

- (void)viewDidLoad {
[super viewDidLoad];

UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(screenTapped:)];
[[self view] addGestureRecognizer:tapRecognizer];
[tapRecognizer release];
}

At the end implement the method to handle the tap on the screen

- (void)screenTapped:(UITapGestureRecognizer *)tap {

CGPoint point = [tap locationInView:[af scrollView]];

if (CGRectContainsPoint([[af selectedCoverView] frame], point)) {
            // Write here the code to open your view
            // Use [af selectedCoverView].number to get the index of the selected cover
    NSLog(@"selected cover view: %d", [af selectedCoverView].number);
}

}

Hope it's going to save you some time! ;)

蓝咒 2024-11-17 04:47:48

请尝试其他 FlowCover 这非常容易使用...

谢谢

Please try other FlowCover this is very easy to use...

Thanks

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文