6
votes

I integrate the iCarousel app with single view application.But when I add the tab bar controller and place this iCarousel code in one tab bar Item viewcontroller.But it does not work(Items are displayed but not scrolled).What is the problem here.

I created iCarousel as below:

iCarousel *categorySubView = [[iCarousel alloc]initWithFrame:CGRectMake(0,200, 300, 125)];

    categorySubView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    categorySubView.delegate = self;
    categorySubView.dataSource = self;
    categorySubView.type=iCarouselTypeRotary;
    [self.view addSubview:categorySubView];

I am using the following delegae and data source methods:

-(NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel
{

    return 5;
}
- (UIView *) carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view{
    UIView *sampleView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 250, 300)];
    sampleView.backgroundColor=[UIColor whiteColor];
    UILabel *labelis=[[UILabel alloc]initWithFrame:CGRectMake(10, 10, 100, 20)];
    labelis.backgroundColor=[UIColor clearColor];
    labelis.text=@"8Apr-14Apr";
    [sampleView addsubView:labelis];
return sampleView;
}

Please suggest me.

Thanks inadvance

1
what do you mean by "Items are displayed but not scrolled"?NightFury
items means either images or custom viewsrani
Please post your datasource and delegate methods for iCarousel implementation.NightFury

1 Answers

2
votes

I notice that your carousel view is much smaller than the size of the items inside it (it's only 125 points high).

iCarousel can draw outside of its bounds, but it cannot detect touch events outside of its bounds, so that might be why you are having trouble scrolling.

A good way to debug this is to set the carousel.clipsToBounds = YES, that way what it draws will match what is touchable. Another option is to set the carousel.backgroundColor so you can see what part of it is touchable on screen.

Another thing to check is that the view that you've placed the carousel inside has userInteractionEnabled set to YES.