Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to show iCarousel center view only highlighted other nearest view show some dark

i am Displaying Images using iCarousel, and its display type is carousel.type = iCarouselTypeRotary; all working fine but i need some changes in its displaying UI. I want to display only center view show original alpha and color with highlighted other nearest two view show dark. i did google but not fined any solution. please give me some suggestion or guide how to achieve this.

i explain this using Screenshot Bellow:-

After impliment iCarousel Displaying Images Like this:-

enter image description here

i want to display like nearest two images view of center imageview like bellow:-

enter image description here

please help me on this thank you .

like image 499
Nitin Gohel Avatar asked Dec 21 '22 05:12

Nitin Gohel


1 Answers

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).

like image 79
Nick Lockwood Avatar answered Dec 24 '22 11:12

Nick Lockwood