Created
January 17, 2020 11:52
-
-
Save X901/4368bca3af1fdcac2b1d20de52a0eec8 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 | |
//BetterExperimentTableview | |
// | |
//Created by Basel Baragabah on 16/01/2020. | |
//Copyright © 2020 Basel Baragabah. All rights reserved. | |
// | |
import UIKit | |
class ViewController: UIViewController { | |
@IBOutlet weak var tableView: UITableView! | |
var arrayData = [String]() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
setUpData() | |
} | |
func setUpData(){ | |
for n in 0...200 { | |
arrayData.append("Cell Number: \(n)") | |
} | |
} | |
} | |
extension ViewController: UITableViewDataSource { | |
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
return arrayData.count | |
} | |
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
let cell = tableView.dequeueReusableCell(withIdentifier: "dataCell", for: indexPath) | |
cell.textLabel?.text = arrayData[indexPath.row] | |
return cell | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment