【问题标题】:In iCarousel images are overlapping.在 iCarousel 中,图像是重叠的。
【发布时间】:2012-04-24 09:40:59
【问题描述】:

我的代码在下面

- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view
{
    UIImageView *imgView = nil;

    if (view == nil)
    {
        NSLog(@"no is %i",index);

        view = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 255, 255)] autorelease];

        imgView = [[[UIImageView alloc] initWithImage:[ImagesCFArray objectAtIndex:index]] autorelease];

        [view addSubview:imgView];

    }

    else 
    {

    }

    return view;
}

ImagesCfArray 包含要显示的图像。当轮播移动或滚动时,第 0 个索引图像与其他图像重叠。请给我解决方案。

【问题讨论】:

  • 你在哪里增加索引?

标签: ios xcode4.3 icarousel


【解决方案1】:

你能展示你的 itemWidth 实现吗?它返回的值是否超过 255?

【讨论】:

    【解决方案2】:

    你可能想告诉子视图剪辑到它的边界:

    imgView.clipToBounds = YES;

    另外,也许对图像使用填充:

    imgView.contentMode = UIViewContentModeScaleAspectFit;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-28
      • 1970-01-01
      • 1970-01-01
      • 2023-03-28
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多