ios6 - iCarousel 与 iOS 6.1 中具有标签栏 Controller 的应用程序集成

标签 ios6 uitabbarcontroller icarousel

我将 iCarousel 应用程序与单 View 应用程序集成在一起。但是当我添加标签栏 Controller 并将此 iCarousel 代码放在一个标签栏项目 View Controller 中时。但它不起作用(显示项目但不滚动)。这里有什么问题。

我创建了 iCarousel,如下所示:

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

我正在使用以下委托(delegate)和数据源方法:
-(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;
}

请给我建议。

提前致谢

最佳答案

我注意到您的轮播 View 比其中的项目大小要小得多(它只有 125 点高)。

iCarousel 可以在其边界之外绘制,但它无法检测到其边界之外的触摸事件,因此这可能是您无法滚动的原因。

调试它的一个好方法是设置 carousel.clipsToBounds = YES,这样它绘制的内容将匹配可触摸的内容。另一种选择是设置 carousel.backgroundColor 以便您可以在屏幕上看到它的哪一部分是可触摸的。

要检查的另一件事是,您放置轮播的 View 已将 userInteractionEnabled 设置为 YES。

关于ios6 - iCarousel 与 iOS 6.1 中具有标签栏 Controller 的应用程序集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15895605/

相关文章:

ios - 如何在用户向 UITextView 中键入内容之前禁用“完成”按钮?

iOS模拟器忽略了一半的屏幕?

ios - 使用标签栏 Controller 和导航 Controller

ios - 如何获取停止标签处的字符串?

ios - 单击后退按钮时,iCarousel 显示在上一页中

ios - 如何将图像/数据从 iCarousel 传递到新的 View Controller

ios - 我可以在 iOS 6 中直接使用 Paypal SDK 吗?

ios - 如何从警报 View 中获取值

ios - 在 UITabBarController 上推送 UINavigationController 时 UITableViewCell 消失

ios - 我的 viewDidAppear 未在 View Controller 中调用