nicklockwood / iCarousel

A simple, highly customisable, data-driven 3D carousel for iOS and Mac OS
http://www.charcoaldesign.co.uk/source/cocoa#icarousel
Other
12k stars 2.58k forks source link

Number of items changing the spacing between item #818

Open AshutoshSomkuwar opened 7 years ago

AshutoshSomkuwar commented 7 years ago

As the number of items changing the space between items is also changing

nicklockwood commented 7 years ago

Depending on which carousel style you are using, that may be expected. You can try setting a fixed number of visible items so that it doesn't:

- (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value {
if (option == iCarouselOptionVisibleItems) {
    return <some_number>;
}
return value;

}

LathigaraBhavesh commented 6 years ago

Here return 1 is no spacing between items. so say for example if you want to give 10% space between two items then you can use following code. -(CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value { if (option == iCarouselOptionSpacing) { return 1.1; } return value; }

@nicklockwood Many Thanks for this wonderful git. @github Special Thanks.

somifai commented 5 years ago

Screen Shot 2019-05-07 at 1 57 02 PM

On the photo attached, I've set the number items to three and spacing to 1.1.

Before, the number of items was 10 and the spacing was also 1.1. The spacing was working for this case. But once I changed the number of items to a lower count, the spacing vanished.

Has somebody found a solution to this already?