2012-04-24 6 views
2

私のコードはiCarouselの画像は重なっています。

- (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番目のインデックス画像。私にこれを解決してください。

+0

インデックス? – rishi

答えて

0

itemWidthの実装を表示できますか?それは255以上を返しますか?

0

あなたは、その境界にクリップするサブビューを伝えたいかもしれません:

imgView.clipToBounds = YES;

そしてまた、おそらく画像の塗りを使用します。

あなたが増加している

imgView.contentMode = UIViewContentModeScaleAspectFit;

関連する問題