From cad19d0c2eeec8bac8121a93b6c2002f5bcf2ae0 Mon Sep 17 00:00:00 2001 From: Diego Sanchez Date: Sat, 23 Jan 2016 22:35:42 +0000 Subject: [PATCH] Workaround for automaticallyAdjustsScrollViewInsets bug on iOS 9.0.x --- Chatto/Source/ChatController/ChatViewController.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Chatto/Source/ChatController/ChatViewController.swift b/Chatto/Source/ChatController/ChatViewController.swift index 77903cb..57fb6d4 100644 --- a/Chatto/Source/ChatController/ChatViewController.swift +++ b/Chatto/Source/ChatController/ChatViewController.swift @@ -173,6 +173,14 @@ public class ChatViewController: UIViewController, UICollectionViewDataSource, U } else if !isInteracting || inputIsAtBottom { self.collectionView.contentOffset.y = newContentOffsetY } + + self.workaroundContentInsetBugiOS_9_0_x() + } + + func workaroundContentInsetBugiOS_9_0_x() { + // Fix for http://www.openradar.me/22106545 + self.collectionView.contentInset.top = self.topLayoutGuide.length + self.constants.defaultContentinsets.top + self.collectionView.scrollIndicatorInsets.top = self.topLayoutGuide.length + self.constants.defaultScrollIndicatorInsets.top } func rectAtIndexPath(indexPath: NSIndexPath?) -> CGRect? {