Reputation: 1129
i have some buttons inside scrollview and i want them to scroll automatically and also in countinuous i.e. when first button goes out of screen it should be appended to last of the scrollview
in-short i want to create slider type of effect where each button has image and it is moving continuously in circular manner.
can anybody help with some code. Thanks in advance.
Upvotes: 0
Views: 1320
Reputation: 5977
use iCarousel , it's amazing
https://github.com/nicklockwood/iCarousel
iCarousel is a class designed to simplify the implementation of various types of carousel (paged, scrolling views) on iPhone, iPad and Mac OS. iCarousel implements a number of common effects such as cylindrical, flat and "CoverFlow" style carousels, as well as providing hooks to implement your own bespoke effects. Unlike many other "CoverFlow" libraries, iCarousel can work with any kind of view, not just images, so it is ideal for presenting paged data in a fluid and impressive way in your app. It also makes it extremely easy to swap between different carousel effects with minimal code changes.
automatically scroll:
- (void) autoScrollAdvertise
{
iCarousel *ADPlace = viewAdvertise;
NSInteger count = [ADPlace numberOfItems];
if ( count > 0 )
{
int selected = [ADPlace currentItemIndex];
[ADPlace scrollToItemAtIndex:((selected+1)%count) animated:YES];
}
[self performSelector:@selector(autoScrollAdvertise) withObject:nil afterDelay:ScrollDuration];
}
Upvotes: 3