From b7f4bb87d48b13c3ae400b7a199dc9cef2fd188e Mon Sep 17 00:00:00 2001 From: Pete Smith Date: Sat, 31 Mar 2018 17:47:46 +0100 Subject: [PATCH] Update README.md --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index a42c9b7..edeb666 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,13 @@ ScalingCarousel can be added via both storyboard/xib and code, as described belo * Add a view to the cell's content view, and connect this via the Connections Inspector (in Interface builder) to the cell's mainView IBOutlet. This property is declared in ScalingCarouselCell. You should add any cell content to this view. +* Note: To ensure correct scaling of the ScalingCarouselCell, you need to call the following code after you configure your cell with it's data (e.g in `cellForItem(at:)`): + +``` +cell.setNeedsLayout() +cell.layoutIfNeeded() +``` + ### Code * Create a custom UICollectionViewCell which inherits from ScalingCarouselCell. Initialize the mainView property, which is declared in ScalingCarouselCell; @@ -70,6 +77,13 @@ scalingCarousel.topAnchor.constraint(equalTo: view.topAnchor, constant: 50).isAc * Set your UIViewController as the collection view delegate and implement the UIScrollViewDelegate method scrollViewDidScroll(:). In this method, call the didScroll() method of ScalingCarouselView +* Note: To ensure correct scaling of the ScalingCarouselCell, you need to call the following code after you configure your cell with it's data (e.g in `cellForItem(at:)`): + +``` +cell.setNeedsLayout() +cell.layoutIfNeeded() +``` + ## Example To run the example project, clone the repo, and run `pod install` from the Example directory first.