ContactGroupPersonController.swift 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. //
  2. // ContactGroupPersonController.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 16/7/15.
  6. // Copyright © 2016年 zoneland. All rights reserved.
  7. //
  8. import UIKit
  9. import Alamofire
  10. import AlamofireImage
  11. import AlamofireObjectMapper
  12. import SwiftyJSON
  13. import ObjectMapper
  14. import CocoaLumberjack
  15. class ContactGroupPersonController: UITableViewController {
  16. var superGroup:Group?{
  17. didSet {
  18. let url = AppDelegate.o2Collect.generateURLWithAppContextKey(ContactContext.contactsContextKey, query: ContactContext.subGroupByNameQuery, parameter: ["##name##":(superGroup?.name)! as AnyObject])
  19. myGroupURL = url
  20. }
  21. }
  22. var myGroupURL:String?
  23. var groupContacts:[CellViewModel] = []
  24. override func viewDidLoad() {
  25. super.viewDidLoad()
  26. self.tableView.mj_header = MJRefreshNormalHeader(refreshingTarget: self, refreshingAction: #selector(loadMyGroupData(_:)))
  27. loadMyGroupData(nil)
  28. }
  29. // MARK: - Table view data source
  30. override func numberOfSections(in tableView: UITableView) -> Int {
  31. // #warning Incomplete implementation, return the number of sections
  32. return 1
  33. }
  34. override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  35. // #warning Incomplete implementation, return the number of rows
  36. return (groupContacts.count)
  37. }
  38. override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  39. let cell = tableView.dequeueReusableCell(withIdentifier: "groupItemCell", for: indexPath) as! ContactItemCell
  40. cell.cellViewModel = self.groupContacts[(indexPath as NSIndexPath).row]
  41. return cell
  42. }
  43. func loadMyGroupData(_ sender:AnyObject?){
  44. AF.request(myGroupURL!).responseJSON {
  45. response in
  46. DDLogDebug(response.description)
  47. }
  48. }
  49. }