Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. import UIKit
  2.  
  3. class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource {
  4.  
  5.  
  6. @IBOutlet weak var myTableView: UITableView!
  7. override func viewDidLoad() {
  8. super.viewDidLoad()
  9. myTableView.dataSource = self
  10. myTableView.delegate = self
  11. }
  12. func numberOfSections(in tableView: UITableView) -> Int {
  13. return 1
  14. }
  15. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  16. return 3
  17. }
  18. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  19. let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
  20. cell.textLabel?.text = "iPhone"
  21. return cell
  22. }
  23.  
  24. override func didReceiveMemoryWarning() {
  25. super.didReceiveMemoryWarning()
  26. // Dispose of any resources that can be recreated.
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement