我在我的应用中使用iCarouselTypeCoverFlow库。我想模糊背面图像。
我能够在viewForItemAtIndex中模糊图像。但滚动时我无法更新。这是我的viewForItemAtindex
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index
{
image = [items objectAtIndex:index];
button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, image.size.width, image.size.height)];
[button setBackgroundImage:image forState:UIControlStateNormal];
[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
button.titleLabel.font = [button.titleLabel.font fontWithSize:50];
button.tag=index;
//NSLog(@"%d %d",carousel.currentItemIndex,index);
if (selectedindex == index) {
[button setBackgroundImage:[items objectAtIndex:index] forState:UIControlStateNormal];
}
else {
[button setBackgroundImage:[self blurredImageWithImage:[items objectAtIndex:index]] forState:UIControlStateNormal];
}
return button;
}
这是我的didscroll
- (void)carouselDidScroll:(iCarousel *)carousel
{
NSInteger current = (carousel.currentItemIndex);
// NSLog(@"%d", current);
NSInteger nextIndex = (carousel.currentItemIndex + 1) % carousel.numberOfItems;
// NSLog(@"%d", nextIndex);
NSInteger prevIndex = (carousel.currentItemIndex + carousel.numberOfItems - 1) % carousel.numberOfItems;
// NSLog(@"%d", prevIndex);
}
任何建议或帮助都将不胜感激。