I want to make an animation like this link:
https://www.pinterest.com/pin/420523683937443901/sent/?sender=335307272165049646&invite_code=f63f81c77d28a48e6181db7d
You must use UIScrollViewDelegate
in your tableView to intercept scrollView actions with:
class YourClass: YourType, UIScrollViewDelegate {}
Check the official apple documentation
You can handle scrollview looking for scrollViewDidScroll(_:) method.
This is just an example to add more network data when the user scroll to the end, you can use it to trigger your header animation..
let threshold = 100.0 // threshold from bottom of tableView
var isLoadingMore = false // flag
func scrollViewDidScroll(scrollView: UIScrollView) {
let contentOffset = scrollView.contentOffset.y
let maximumOffset = scrollView.contentSize.height - scrollView.frame.size.height;
if !isLoadingMore && (maximumOffset - contentOffset <= threshold) {
// Get more data - API call
self.isLoadingMore = true
// Update UI
dispatch_async(dispatch_get_main_queue()) {
tableView.reloadData()
self.isLoadingMore = false
}
}
}
UPDATE:
By analizying your animation, it's not simple but not impossible :) I can see two different states:
And the second state:
You can organize your controller by choose a UIViewController
type.
This UIViewController must be composed by:
P.S. The tableViewHeader can be the gray label with the date: Thursday 21 January 2016, as you can see the dimension dont change during animation.