Horizontal scrollable view with specific content width.
UICarouselScrollView is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "UICarouselScrollView"
And then run:
$ pod install
@required
- (UIView *)carouselScrollView:(UICarouselScrollView *)view viewAtPage:(NSInteger)page;
@optional
- (void)carouselScrollView:(UICarouselScrollView *)view clickedAtPage:(NSInteger)page;
- (NSString *)carouselScrollView:(UICarouselScrollView *)view titleAtPage:(NSInteger)page;
- (NSString *)carouselScrollView:(UICarouselScrollView *)view subTitleAtPage:(NSInteger)page;
[self.nibView setDelegate:self];
[self.nibView setSlideTime:3];
[self.nibView setShouldDetectNextAndPreviousClickEvent:NO];
[self.nibView setGradientColors:@[(id)[[UIColor blackColor] colorWithAlphaComponent:0].CGColor,(id)[[UIColor blackColor] colorWithAlphaComponent:0.6].CGColor]];
carouselView = [[UICarouselScrollView alloc] initWithFrame:CGRectMake(10, 300, 260, 180)];
[self.view addSubview:carouselView];
[carouselView setDelegate:self];
[carouselView setMaxWidth:200];
[carouselView setSlideTime:2];
[carouselView setShouldDetectNextAndPreviousClickEvent:NO];
[carouselView setGradientColors:@[(id)[[UIColor blackColor] colorWithAlphaComponent:0].CGColor,(id)[[UIColor blackColor] colorWithAlphaComponent:0.6].CGColor]];
@property (nonatomic, assign) NSInteger numberOfPage; //trigger
@property (nonatomic, assign) NSInteger cacheCount; //default = 2 (previous&next pages)
@property (nonatomic, assign) float slideTime; //if 0, don't auto slide
@property (nonatomic, assign) float maxWidth; //if 0, view size
@property (nonatomic, assign) BOOL shouldDetectNextAndPreviousClickEvent;
skswhwo, skswhwo@gmail.com
UICarouselScrollView is available under the MIT license. See the LICENSE file for more info.