I want to use carousel in my objective-c application. I have an UIViewController containing an UIView (with a specific width and height). The content of this UIView must be as a carousel: Every item of my carousel should have an image and some text. I want also to have under the carousel, points (little circles). The points indicate the number of items and the point of the current item should have a different color than the other points. I found that the most famous carousel library is the iCarousel.
My question: How can I use the iCarousel having UIViews as items?
Edit:
I added iCarousel
to my project, made the iCarousel as subClass of my UIView in the storyboad as @property (weak, nonatomic) IBOutlet iCarousel *carouselView;
. Then in myViewController.h
I added
@interface myViewController : UIViewController<iCarouselDataSource>
.
In myViewController.m
:
- (NSInteger)numberOfItemsInCarousel:(iCarousel *)carousel
{
return 4;
}
-(UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view {
self.carouselTitle.text = [self.titleDataSource objectAtIndex:index];
self.carouselImage.image = [UIImage imageNamed:[self.imageDataSource objectAtIndex:index]];
return self.carouselView;
}
The problem now is that when I run my application, it crash mentioning this line in the iCarousel.m : [_contentView addSubview:[self containView:view]];
(line 1260)
Any help please?