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

Current card frame in superview coordinates #840

Open prezessikora opened 6 years ago

prezessikora commented 6 years ago

How do I get carousel current card frame in superview coordinates.

I save current card:

func carouselCurrentItemIndexDidChange(_ carousel: iCarousel) {
    currentCard = carousel.currentItemView! as! CardArtistView
}

and when clicked on card I want to know the exact position (frame) yet as I get proper width and height the origin is useless:

let currentCardFrame = currentCard.convert(currentCard.frame, to: self.view)

or

let currentCardFrame = currentCard.convert(currentCard.frame, to: carousel.contentView)

return x= 0 and y=-150 or y=-170 which is strange as the card of timemachine courses sits somewhere in the middle of screen.

Thanks!