nicklockwood / iCarousel

A simple, highly customisable, data-driven 3D carousel for iOS and Mac OS
http://www.charcoaldesign.co.uk/source/cocoa#icarousel
Other
12.01k stars 2.58k forks source link

iCarousel for Cylinder type with Custom views scroll problem #96

Open sarahbdlrzk opened 12 years ago

sarahbdlrzk commented 12 years ago

Hi Nick,

I'm using iCarousel with Cylinder type and it is working great thanks alot for this library. I'm facing an issue when scrolling between views, I have 7 views with width 560 px I'm setting wrap = YES; . The cylinder keeps moving with me and suddenly it turns and moves on the opposite direction. I would really appreciate your help. Thanks alot.

nicklockwood commented 12 years ago

Are you setting wrap by returning YES from the delegate method, or have you copied the example and set the wrap property?

sarahbdlrzk commented 12 years ago

I set up the iCarousel like this and I return the wrap on delegate method.

iCarousel *contentPanel = [[iCarousel alloc] initWithFrame: CGRectMake(18, 25, 1000, 333)];

contentPanel.delegate = self; contentPanel.dataSource =self; self.myContentPanel = contentPanel; [contentPanel release]; [myContentPanel setBackgroundColor:[UIColor clearColor]]; myContentPanel.type = iCarouselTypeCylinder; wrap = YES;

[self.innerModuleViews addSubview:myContentPanel];

nicklockwood commented 12 years ago

Your shouldWrap method looks like a copy of a method from inside iCarousel itself - is that in your viewController? Why is it there?

nicklockwood commented 12 years ago

You should add a method to your viewController called carouselShouldWrap: (look at the iOS example and copy the one from that view controller) an in it remove all the logic and just return YES.

sarahbdlrzk commented 12 years ago

On my view controller I'm implementing this delegate method. The views are already wrapping with me multiple times. The problems happens after some time when I'm scrolling quickly that the cylinders rotates on the opposite direction.

nicklockwood commented 12 years ago

That's odd. Perhaps if you flick it too hard it's just getting confused and reading the swipe as the wrong direction.

sarahbdlrzk commented 12 years ago

Is there a way to correct swipe direction?

mralexgray commented 12 years ago

@sarahbdlrzk have you implemented the

@property (nonatomic, assign) BOOL ignorePerpendicularSwipes;?

it definitely helps…

If YES, the carousel will ignore swipe gestures that are perpendicular to the orientation of the carousel. So for a horizontal carousel, vertical swipes will not be intercepted. This means that you can have a vertically scrolling scrollView inside a carousel item view and it will still function correctly. Defaults to YES.

but I think I know what you mean? i'm speaking of the mac os version, but when I alter content or viewport offsets, the NSImageViews go berserk.. like up and down sorta… is that what you are talking about?

arvindkrishnan commented 11 years ago

This is an awesome control - was so incredibly useful in adding some very powerful functionality, thanks so much