         let topInset = topView.frame.height + 20.0
         scrollView.contentInset = UIEdgeInsets(top: topInset, left: 0, bottom: 0, right: 0)
         scrollView.setContentOffset( CGPoint(x: 0.0, y: -scrollView.contentInset.top), animated: false)
+        lastOffset = scrollView.contentOffset.y
+        scrollView.delegate = self
     }
     
     override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {


    }
}

// MARK: UIViewControllerTransitioningDelegate
extension MainViewController: UIViewControllerTransitioningDelegate{
    func animationControllerForPresentedController(presented: UIViewController, presentingController presenting: UIViewController, sourceController source: UIViewController) -> UIViewControllerAnimatedTransitioning? {

        let itemWidth = scrollViewWidth / CGFloat(numberOfItemsPerRow)
        let rowHeight: CGFloat = 135.0
        
        // setup item in scrollView
        itemRows = []
        var count = 0
        for row in 0..<numberOfRows{
            var itemRow = [MainItemView]()
            for col in 0..<numberOfItemsPerRow{
                let xOffset = itemWidth * CGFloat(col)
                let yOffset = rowHeight * CGFloat(row)
