Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.96 KB | None | 0 0
  1. import UIKit
  2. class PunchClockVC: UIViewController , UITableViewDataSource, UITableViewDelegate{
  3. var appdel = UIApplication.sharedApplication().delegate as! AppDelegate
  4.  
  5. @IBOutlet weak var dropdownTable: UITableView!
  6. @IBOutlet weak var mainTable: UITableView!
  7. override func viewDidLoad() {
  8. super.viewDidLoad()
  9. self.mainTable.registerClass(PunchClockCustomCell.self, forCellReuseIdentifier: "PunchClockCustomCell")
  10. self.dropdownTable.registerClass(UITableViewCell.self, forCellReuseIdentifier: "dropdowncell")
  11. self.dropdownTable.hidden = true
  12. }
  13. @IBAction func textFieldTapped(sender: AnyObject) {
  14. if self.dropdownTable.hidden == true {
  15. self.dropdownTable.hidden = false
  16. }
  17. else{
  18. self.dropdownTable.hidden = false
  19. }
  20. }
  21. func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
  22. if tableView == dropdownTable{
  23. let cell = tableView.dequeueReusableCellWithIdentifier("dropdowncell", forIndexPath: indexPath) as UITableViewCell
  24.  
  25. cell.textLabel?.text = jobArray[indexPath.row] as? String
  26. return cell
  27. }
  28. else
  29. {
  30. let cell = tableView.dequeueReusableCellWithIdentifier("PunchClockCustomCell", forIndexPath: indexPath) as! PunchClockCustomCell
  31.  
  32. if indexPath.row == 0
  33. {
  34. cell.jobcell?.font = UIFont(name: "MuseoSlab-500", size: 25.0)
  35. cell.locationcell?.font = UIFont(name: "MuseoSlab-500", size: 25.0)
  36. cell.timecell?.font = UIFont(name: "MuseoSlab-500", size: 25.0)
  37. cell.typecell?.font = UIFont(name: "MuseoSlab-500", size: 25.0)
  38.  
  39.  
  40. cell.jobcell?.textColor = UIColor.blackColor()
  41. cell.locationcell?.textColor = UIColor.blackColor()
  42. cell.timecell?.textColor = UIColor.blackColor()
  43. cell.typecell?.textColor = UIColor.blackColor()
  44.  
  45.  
  46. cell.jobcell?.text = "Job"
  47. cell.locationcell?.text = "Location"
  48. cell.timecell?.text = "Time"
  49. cell.typecell?.text = "Type"
  50. return cell
  51.  
  52. }
  53. else {
  54. cell.jobcell?.text = "Jobdata"
  55. cell.locationcell?.text = "Locationdata"
  56. cell.timecell?.text = "Timedata"
  57. cell.typecell?.text = "OUT"
  58. return cell
  59.  
  60. }
  61.  
  62.  
  63. }
  64. }
  65.  
  66. func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
  67. if tableView == dropdownTable {
  68. txtFieldSelectJob.text = jobArray[indexPath.row] as? String
  69. }
  70. self.dropdownTable.hidden = true
  71. }
  72. func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
  73. var sectiontitle = ""
  74. if tableView == dropdownTable
  75. { sectiontitle = "Select A Job"}
  76. return sectiontitle
  77. }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement