私はSwiftで新しく、配列を使用して無限のスクロールを作成します。ここでは、私が方法がわからない私は、配列の最初の10個の項目を表示したいと私はTableViewControllerの底に午前とき、それはなど、次の10の項目をロードする私のクラスTableViewControllerUITableViewと配列を持つ無限スクロール
class TableViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
var legumes: [String] = ["Eggs", "Milk", "Chocolat", "Web", "Miel", "Pop", "Eco", "Moutarde", "Mayo", "Thea", "Pomelade", "Gear", "Etc" , "Nop", "Dews", "Tout", "Fun", "Xen" , "Yoga" ]
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.delegate = self
self.tableView.dataSource = self
func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.legumes.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = self.tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! ImageTableViewCell
return cell
}
}
ですそうするためには、私はGitHub上で多くのコードを見ていますが、それらを実装する方法はわかりません。
ありがとうございました。
を望むようにPagingTableView
が動作するのpaginate関数を変更し使用することを検討してください。迅速なテーブルビュー遅延読み込みを検索して、より多くの例を得ることができます。 – wyoskibum