我有一个包含 20 个图像的数组,使用滚动视图将该图像添加到 imageview。所有图像滚动。
我想为我所有的 20 张图像添加旋转木马圆圈效果,我该怎么做?我试过了,但没用。
也将 iCarousel.h,iCarousel.m 添加到我的包定义委托中。
<iCarouselDataSource,iCarouselDelegate,UIScrollViewDelegate>
-(void)viewDidLoad
{
iCarousel *icrusal = [[iCarousel alloc]initWithFrame:CGRectMake(0,0, 320, 480)];
icrusal.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
icrusal.delegate = self;
icrusal.dataSource = self;
icrusal.type=iCarouselTypeRotary;
icrusal.type=iCarouselTypeCoverFlow;
[self.view addSubview:icrusal];
}
-(NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel
{
return 20;
}
-(UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index
{
//ImgView=[[UIImageView alloc]init];
ImgView=[[UIImageView alloc]init];
return ImgView;
}
- (BOOL)carousel:(iCarousel *)carousel shouldSelectItemAtIndex:(NSInteger)index{
return YES;
}
- (CGFloat)carouselItemWidth:(iCarousel *)carousel
{
//usually this should be slightly wider than the item views
return 180;
}
我怎么能这样做提前谢谢。