我已经将 iCarousel 的这种方法实现为,
它在开始时变得粘滞,几秒钟后它允许我滚动。而且我不希望图像在滚动时重叠,我希望它们在每个项目之间都具有相等的距离。
这段代码有什么问题?或者我错过了什么?
-(void)addiCarousel
{
carousel.frame = CGRectMake(324, 50, 375, 195);
[self.view addSubview:carousel];
self.items = [[NSMutableArray alloc] initWithObjects:@"1.jpg",@"2.jpg",@"3.jpg",@"4.jpg",@"5.jpg", nil];
carousel.type = iCarouselTypeCoverFlow2;
[carousel reloadData];
}
- (NSUInteger)numberOfItemsInCarousel:(iCarousel *)carousel
{
return [items count];
}
- (BOOL)carouselShouldWrap:(iCarousel *)carousel
{
return NO;
}
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view
{
// if (view == nil)
// {
view = [[[UIImageView alloc] initWithFrame:CGRectMake(649, 50, 375 , 195)] autorelease];
view.contentMode = UIViewContentModeCenter;
view.layer.borderWidth = 8.0f;
view.layer.borderColor = [[UIColor blackColor] CGColor];
view.contentMode = UIViewContentModeScaleToFill;
// }
((UIImageView *)view).image = [UIImage imageNamed:[self.items objectAtIndex:index]];
NSLog(@"index : %d",index);
NSLog(@"%@",[self.items objectAtIndex:index]);
return view;
}