There are various ways to achieve this. The carousel:itemAlphaForOffset:
answers you've already received are a good approach, but they'll involve doing a bit of maths.
If you have a recent version of iCarousel
, you can implement this more easily using the options API. Add this method to your UIViewController
(if you are using the example project it may already be in there and you'll need to modify it):
- (CGFloat)carousel:(iCarousel *)carousel
valueForOption:(iCarouselOption)option
withDefault:(CGFloat)value {
switch (option) {
case iCarouselOptionFadeMin:
return 0;
case iCarouselOptionFadeMax:
return 0;
case iCarouselOptionFadeRange:
return 2;
default:
return value;
}
}
You can replace the 2 with a bigger or smaller number to increase or decrease the opacity of the side views. For example, a value of 3 will make them less transparent. A value of 1.5 will make them more transparent. (A value of 1 will make them invisible).