1
votes

Is there some way to prevent iCarousel from scrolling? Like, a "lock screen" feature? When i press a button, it should stop scrolling and when the button is pressed a second time, it'll start scrolling again. Is there any way to do this?

4

4 Answers

3
votes

The carousel uses a pan gesture recogniser to control the scrolling. If you get access to that gesture you can disable it (and then re-enable it again later).

1
votes

If you just want to prevent the user from interacting with the carousel then simply write

[carousel setUserInteractionEnabled:NO];

To start scrolling then the first button is pressed write:

-(IBAction) spinButton:(id)sender {

   [carousel scrollByNumberOfItems:30 duration:10];

}

To stop scrolling then the second button is pressed write:

-(IBAction) stopButton:(id)sender {

[carousel scrollToItemAtIndex:[carousel currentItemIndex] animated:YES];    
}
1
votes

This is possible by:

[carousel setScrollEnabled:NO];
0
votes

You can set this view property to NO:

@property(nonatomic, getter=isUserInteractionEnabled) BOOL userInteractionEnabled

It will disable touch handling of your carousel view.