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

show front side of item in iCarouselTypeCylinder #819

Open ssbum0925 opened 6 years ago

ssbum0925 commented 6 years ago

Your iCarousel is very beautiful and useful library, thank you.

When I was using your code, I had a question.

Your iCarouselTypeCylinder works perfect but I want to see only front side of every items.

It shows left or right side of item(I added imageview as)according to current item angle, now.

Is there any way to adjust this problem?? I just want to see front side.

nicklockwood commented 6 years ago

If I understand correctly, you need to use iCarouselOptionShowBackfaces. Add this to your delegate:

- (CGFloat)carousel:(iCarousel *)carousel valueForOption:(iCarouselOption)option withDefault:(CGFloat)value {
    if (option == iCarouselOptionShowBackfaces) {
        return (CGFloat)NO;
    }
    return value;
}
ssbum0925 commented 6 years ago

Thank you for your reply :D but, your solution was not I wanted..

Anyway, I found my own solution!

What I asked was this.

ㅡ                 <- this shape  is current iCarouseltypeCyinder

| | ㅡ (front)

  ㅡ               <- this shape is what I wanted

ㅡ ㅡ ㅡ (front)

I changed view.superview.layer.transform = transform; to

view.superview.layer.transform = CATransform3DRotate(transform, -1 * offset * (2 * M_PI) / [self circularCarouselItemCount], 0, 1.0, 0);

in transformItemView method and it works perfect!

Thank you :D

nicklockwood commented 6 years ago

Oh, I misunderstood what you were asking then. But did you try iCarouselTypeRotary instead of iCarouselTypeCylinder?

ssbum0925 commented 6 years ago

Well.. I need to make carousel three-dimensional so, I'm not sure the iCarouselTypeRotary works. :D

Anyway, I have another question.

I should catch the moment of icarousel completed loading. Is there any delegate to know whether [icarousel reloadData] finished or not??? If it is, how can I use it?

nicklockwood commented 6 years ago

iCarouselTypeRotary is 3-dimensional. It looks like this (from above):

     -  -
  -        -
    -    -

   (front)