Próbuję zaimplementować ładowanie danych z mojego backendu za pomocą stronicowania. Widziałem to, ale ładuje wszystkie dane, cały czas. Czy to jest właściwa droga, czy robię coś złego?UITableView Paginacja - od dołu Odśwież, aby załadować nowe dane w Swift
Z góry dziękuję.
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as UITableViewCell
print(indexPath.row)
if (indexPath.row + 1 < self.TotalRowsWithPages) {
cell.textLabel?.text = "\(self.myarray!.[indexPath.row].body)"
} else {
cell.textLabel?.text = "Loading more data...";
// User has scrolled to the bottom of the list of available data so simulate loading some more if we aren't already
if (!self.isLoading) {
self.isLoading = true;
self.TotalRowsWithPages = self.TotalRowsWithPages + self.PageSize
self.getmoredata()
}
}
return cell
}
Nie działa w Swift 4 –
@UtkuDalmaz Czy możesz mi powiedzieć, co dokładnie nie działa? –
Operator binarny "==" nie może być zastosowany do argumentów typu "UIScrollView" i "_" –