DroidsOnRoids / SwiftCarousel

Lightweight, written natively in Swift, circular UIScrollView.

Home Page:http://www.thedroidsonroids.com/blog/ios/circular-scroll-view-swiftcarousel/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Placing Items Vertically Centered

dulimarta opened this issue · comments

I have images of same width but various heights that I'd like to place vertically centered in the carousel.
The current settings are:

// For the carousel
myCarousel.resizeType = .WithoutResizing(1.0)

// For each image in the carousel
myImgView.contentMode = UIViewContentMode.ScaleAspectFit
myImgView.frame = CGRectMake (0, /* x-offset */
                              0, /* y-offset */ 
                              width, scaledHeight)

The issue is setting the y-offset to a non-zero would freeze the carousel to scroll.

I tried changing the image content mode to myImageView.contentMode = UIViewContentMode.Center, but the images would not scale correctly.

commented

Hey @dulimarta. Sorry for getting so late back to you. This is a bug because as of now there are few places where the y property is not really coded as it should. I will take a look at it in the next few days!