ContactViewController.swift 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //
  2. // ContactViewController.swift
  3. // SocketChat
  4. //
  5. // Created by Justine on 16/5/27.
  6. // Copyright © 2016年 AppCoda. All rights reserved.
  7. //
  8. import UIKit
  9. class ContactViewController: UIViewController,UITableViewDelegate,UITableViewDataSource {
  10. var tableView:UITableView?
  11. var dataList = NSMutableArray()
  12. override func viewDidLoad() {
  13. super.viewDidLoad()
  14. self.view.backgroundColor = UIColor.greenColor()
  15. // Do any additional setup after loading the view.
  16. self.tableView?.dataSource = self
  17. self.tableView?.delegate = self
  18. }
  19. override func didReceiveMemoryWarning() {
  20. super.didReceiveMemoryWarning()
  21. // Dispose of any resources that can be recreated.
  22. }
  23. /*
  24. // MARK: - Navigation
  25. // In a storyboard-based application, you will often want to do a little preparation before navigation
  26. override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
  27. // Get the new view controller using segue.destinationViewController.
  28. // Pass the selected object to the new view controller.
  29. }
  30. */
  31. //实现继承的委托中的两个方法
  32. func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
  33. return 100;
  34. }
  35. //返回Cell
  36. func tableView(tableView:UITableView, cellForRowAtIndexPath indexPath:NSIndexPath)->UITableViewCell{
  37. //根据需求自己重绘
  38. let cell = UITableViewCell(style: .Default, reuseIdentifier: "cell")
  39. // let cellID="Cell ID";
  40. // var cell=tableView.dequeueReusableCellWithIdentifier(cellID) as? UITableViewCell;
  41. //
  42. return cell;
  43. }
  44. }