ran*_*ani 6 uitabbarcontroller icarousel ios6
我将iCarousel应用程序与单视图应用程序集成.但是当我添加标签栏控制器并将此iCarousel代码放在一个标签栏中时,项目viewcontroller.But它不起作用(项目显示但不滚动).这里有什么问题.
我创建了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];
Run Code Online (Sandbox Code Playgroud)
我使用以下delegae和数据源方法:
-(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;
}
Run Code Online (Sandbox Code Playgroud)
请建议我.
提前致谢
我注意到您的轮播视图比其中的项目尺寸小得多(只有 125 点高)。
iCarousel 可以在其边界之外进行绘制,但它无法检测到其边界之外的触摸事件,因此这可能就是您在滚动时遇到问题的原因。
调试此问题的一个好方法是设置 carousel.clipsToBounds = YES,这样它绘制的内容将与可触摸的内容匹配。另一个选项是设置 carousel.backgroundColor,以便您可以看到屏幕上可触摸的部分。
另一件需要检查的事情是您放置轮播的视图的 userInteractionEnabled 设置为 YES。
| 归档时间: |
|
| 查看次数: |
413 次 |
| 最近记录: |