Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iCarousel integration to app having Tab bar controller in iOS 6.1

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

like image 936
rani Avatar asked Apr 09 '13 07:04

rani


1 Answers

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.

like image 166
Nick Lockwood Avatar answered Nov 13 '22 07:11

Nick Lockwood