How to show iCarousel center view only selected other nearest view show some dark

I display images using iCarousel, and its display type is carousel.type = iCarouselTypeRotary; works fine, but I need to make some changes to its user interface display. I want to display only the center view showing the original alpha and color, with the other two highlighted showing the darkness highlighted. I did google but did not fine any solution. please give me some suggestion or guidance on how to achieve this.

I will explain this with a screenshot: -

After the implementation of iCarousel Image Display: -

enter image description here

I want to show how the next two images look like the center of the image, like a roar: -

enter image description here

Please help me with this thanks.

+4
source share
1 answer

There are various ways to achieve this. The answers of carousel:itemAlphaForOffset: that you have already received are a good approach, but they will include a few mathematical calculations.

If you have the latest version of iCarousel , you can implement this more easily using the APIs. Add this method to your UIViewController (if you are using an example project, it might already be there, and you need to change 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 2 with a larger 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.)

+11
source

Source: https://habr.com/ru/post/1482098/


All Articles