Created
March 19, 2018 06:31
-
-
Save codeOfRobin/c23746c6fae913686c92c6162a0e71c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// TableViewPaging | |
// | |
// Created by Robin Malhotra on 19/03/18. | |
// Copyright © 2018 Robin Malhotra. All rights reserved. | |
// | |
import UIKit | |
class ViewController: UIViewController, UITableViewDataSource { | |
let tableView = UITableView() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
view.addSubview(tableView) | |
tableView.dataSource = self | |
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell") | |
// Do any additional setup after loading the view, typically from a nib. | |
} | |
override func viewDidLayoutSubviews() { | |
super.viewDidLayoutSubviews() | |
tableView.frame = view.bounds | |
} | |
func numberOfSections(in tableView: UITableView) -> Int { | |
return 1 | |
} | |
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
//does messing with this value cause changes in memory issues | |
return 1000 | |
} | |
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) | |
cell.textLabel?.text = "\(indexPath.row)" | |
return cell | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment