I am trying to animate the tableviews height when the collection view scrolls. I call the animation function from scrollViewWillBeginDragging. Then I execute an animation block:
func scrollViewWillBeginDragging(scrollView: UIScrollView) {
if expanded == false && scrollView == IBcalendarCollectionView {
expanded = true
expandCollectionView()
}
}
func expandCollectionView() {
let screenSize: CGRect = UIScreen.mainScreen().bounds
UIView.animateWithDuration(3, delay: 0, options: UIViewAnimationOptions.TransitionNone, animations: { () -> Void in
self.IBcalendarTableView.frame = CGRectMake(self.IBcalendarTableView.frame.origin.x, screenSize.height/2, self.IBcalendarTableView.frame.width, screenSize.height/2)
}) { (success) -> Void in
print(self.IBcalendarTableView.frame.origin.y)
}
}
Whats happening is the TableView animates up to the status bar then returns to its original position. I want it to animate down to half the size of the screen. The animation block is only executed once because I set a boolean when the animation function is called.