Skip to content

skswhwo/UICarouselScrollView

Repository files navigation

UICarouselScrollView

Horizontal scrollable view with specific content width.

alt text alt text

Installation

UICarouselScrollView is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "UICarouselScrollView"

And then run:

$ pod install

Usage

Delegate

@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;

Nib

[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]];

Programmatically

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]];

Properties

@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;

Author

skswhwo, skswhwo@gmail.com

License

UICarouselScrollView is available under the MIT license. See the LICENSE file for more info.

About

Carousel scrollview

Resources

License

Stars

Watchers

Forks

Packages

No packages published