开发者

Open a view on image Click in cover flow

I am using cover flow library in my projec开发者_StackOverflow社区t.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.


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! ;)


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

Thanks

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜