Advertisement
Guest User

Untitled

a guest
Feb 27th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. import UIKit
  2.  
  3. class MyViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
  4. @IBOutlet weak var tableView: UITableView!
  5.  
  6. override func viewDidLoad() {
  7. super.viewDidLoad()
  8. }
  9.  
  10. func numberOfSections(in tableView: UITableView) -> Int {
  11. return 2
  12. }
  13.  
  14. func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  15. if section == 0 {
  16. return 3
  17. } else {
  18. return 2
  19. }
  20. }
  21.  
  22. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  23. if indexPath.section == 0 {
  24. let cell = tableView.dequeueReusableCell(withIdentifier: "MyTableViewCell", for: indexPath)
  25. cell.textLabel?.text = "Prototype"
  26. return cell
  27. } else {
  28. let cell = tableView.dequeueReusableCell(withIdentifier: "MySecondTableViewCell", for: indexPath)
  29. cell.textLabel?.text = "Other"
  30. return cell
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement