mam na ten sam problem w moim projekcie i znalazł this answer. Możesz dodać instancję UIActivityIndicatorView
na dole tabeli, początkowo ukrytą, a po wejściu w powyższy warunek if, odkryj go i rozpocznij animację.
Może zajść potrzeba zmiany dolnej granicy stołu, dodania do niej wysokości "1 komórki" podczas jej ładowania i umieszczenia jej z powrotem, gdy zakończy się również w warunkach if.
w Swift 3:
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
// Use this 'canLoadFromBottom' variable only if you want to load from bottom iff content > table size
let contentSize = scrollView.contentSize.height
let tableSize = scrollView.frame.size.height - scrollView.contentInset.top - scrollView.contentInset.bottom
let canLoadFromBottom = contentSize > tableSize
// Offset
let currentOffset = scrollView.contentOffset.y
let maximumOffset = scrollView.contentSize.height - scrollView.frame.size.height
let difference = maximumOffset - currentOffset
// Difference threshold as you like. -120.0 means pulling the cell up 120 points
if canLoadFromBottom, difference <= -120.0 {
// Save the current bottom inset
let previousScrollViewBottomInset = scrollView.contentInset.bottom
// Add 50 points to bottom inset, avoiding it from laying over the refresh control.
scrollView.contentInset.bottom = previousScrollViewBottomInset + 50
// loadMoreData function call
loadMoreDataFunction(){ result in
// Reset the bottom inset to its original value
scrollView.contentInset.bottom = previousScrollViewBottomInset
}
}
}
Używam drugą bibliotekę z Swift oraz bez żadnego problemu. Jakie są twoje problemy? Być może będziesz musiał opracować więcej. –