简体   繁体   English

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

[英]Open a view on image Click in cover flow

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.我在我的项目中使用封面流库。我的封面流包含许多图像。我想要做的是当我单击该图像时,另一个视图 Controller 应该打开。 Please tell me how to open another view on that image click.请告诉我如何在该图像单击上打开另一个视图。 Any help will be highly appreciated.任何帮助将不胜感激。

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在 .m 文件中添加这两个方法的实现

@implementation AFOpenFlowView

- (AFItemView *)selectedCoverView {
return selectedCoverView;
}

- (UIScrollView *)scrollView {
return scrollView;
}

Set a UITapGestureRecognizer in the view controller where you're using the AFOpenFlowView在您使用 AFOpenFlowView 的视图 controller 中设置 UITapGestureRecognizer

- (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;希望它能为您节省一些时间; ;) ;)

Please try other FlowCover this is very easy to use...请尝试其他FlowCover这很容易使用...

Thanks谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM