-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to adjust the spacing between the item? #787
Comments
You can implement this func carousel(_ carousel: iCarousel, valueFor option: iCarouselOption, withDefault value: CGFloat) -> CGFloat and return a value for func carousel(_ carousel: iCarousel, valueFor option: iCarouselOption, withDefault value: CGFloat) -> CGFloat {
switch (option) {
case .spacing: return 8 // 8 points spacing
default: return value
}
} Another way to add spacing between items, but only if you are using a custom transform, is to transform the x position of the items based on the offset: func carousel(
_ carousel: iCarousel,
itemTransformForOffset offset: CGFloat,
baseTransform transform: CATransform3D
) -> CATransform3D {
return CATransform3DTranslate(
transform, // base
offset * 1.15 * carousel.itemWidth, // x
0, // y
0 // z
)
} Specifically the All code snippets are in Swift 3.0 |
Thank you very much for your answer, but my code is based on the OC |
I can find the answer from your answer, thank you very much |
@caoyunxiao If your problem is solved please feel free to close this issue |
How to adjust the spacing between the item?
The text was updated successfully, but these errors were encountered: