【发布时间】:2015-12-16 11:21:22
【问题描述】:
我在我的应用程序中使用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;
}
这是我的文档
- (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);
}
任何建议或帮助将不胜感激。
【问题讨论】:
标签: ios objective-c scroll icarousel