iPhone - Carousel

為{幸葍}努か 提交于 2019-12-05 03:26:04

问题


I use open source, iCarousel in my application to bring the carousel control. The carousel type which I use is iCarouselTypeRotary and the images are arranged linearly in this type. But, I need the images to bring like the carousel in the attached images. What should I do to make my carousel little tilted to the top view as the style in the below images? Kindly help. Thanks in advance.


回答1:


You can implement 3D tilt manually:

In iCarousel.m: 574

return CATransform3DTranslate(transform, radius * sin(angle), 0.0f, radius * cos(angle) - radius);

change to:

float tilt = MAX_TILT_VALUE * cos(angle); // greater angle means greater vertical offset
return CATransform3DTranslate(transform, radius * sin(angle), tilt, radius * cos(angle) - radius);

To make the code clear and reusable, implement tilt offset as option (similar to iCarouselOptionArc).

PS: If you want perspective scaling, you will need to add scale transform that depends on cos(angle) similarly to tilt.




回答2:


Check by using the style:iCarouselTypeWheel use the horizontal wheel set the radius of the wheel as you want. I have done this in vertical wheel type. But i think it should the appearance as above using horizontal wheel type.



来源:https://stackoverflow.com/questions/12246237/iphone-carousel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!