2

我的代码如下

- (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 个索引图像与其他图像重叠。请给我解决方案。

4

2 回答 2

0

您可能想告诉子视图剪辑到其边界:

imgView.clipToBounds = YES;

而且,也许对图像使用填充:

imgView.contentMode = UIViewContentModeScaleAspectFit;

于 2012-05-30T19:47:39.740 回答
0

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

于 2012-05-24T12:48:13.030 回答