Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- class PunchClockVC: UIViewController , UITableViewDataSource, UITableViewDelegate{
- var appdel = UIApplication.sharedApplication().delegate as! AppDelegate
- @IBOutlet weak var dropdownTable: UITableView!
- @IBOutlet weak var mainTable: UITableView!
- override func viewDidLoad() {
- super.viewDidLoad()
- self.mainTable.registerClass(PunchClockCustomCell.self, forCellReuseIdentifier: "PunchClockCustomCell")
- self.dropdownTable.registerClass(UITableViewCell.self, forCellReuseIdentifier: "dropdowncell")
- self.dropdownTable.hidden = true
- }
- @IBAction func textFieldTapped(sender: AnyObject) {
- if self.dropdownTable.hidden == true {
- self.dropdownTable.hidden = false
- }
- else{
- self.dropdownTable.hidden = false
- }
- }
- func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
- if tableView == dropdownTable{
- let cell = tableView.dequeueReusableCellWithIdentifier("dropdowncell", forIndexPath: indexPath) as UITableViewCell
- cell.textLabel?.text = jobArray[indexPath.row] as? String
- return cell
- }
- else
- {
- let cell = tableView.dequeueReusableCellWithIdentifier("PunchClockCustomCell", forIndexPath: indexPath) as! PunchClockCustomCell
- if indexPath.row == 0
- {
- cell.jobcell?.font = UIFont(name: "MuseoSlab-500", size: 25.0)
- cell.locationcell?.font = UIFont(name: "MuseoSlab-500", size: 25.0)
- cell.timecell?.font = UIFont(name: "MuseoSlab-500", size: 25.0)
- cell.typecell?.font = UIFont(name: "MuseoSlab-500", size: 25.0)
- cell.jobcell?.textColor = UIColor.blackColor()
- cell.locationcell?.textColor = UIColor.blackColor()
- cell.timecell?.textColor = UIColor.blackColor()
- cell.typecell?.textColor = UIColor.blackColor()
- cell.jobcell?.text = "Job"
- cell.locationcell?.text = "Location"
- cell.timecell?.text = "Time"
- cell.typecell?.text = "Type"
- return cell
- }
- else {
- cell.jobcell?.text = "Jobdata"
- cell.locationcell?.text = "Locationdata"
- cell.timecell?.text = "Timedata"
- cell.typecell?.text = "OUT"
- return cell
- }
- }
- }
- func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
- if tableView == dropdownTable {
- txtFieldSelectJob.text = jobArray[indexPath.row] as? String
- }
- self.dropdownTable.hidden = true
- }
- func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
- var sectiontitle = ""
- if tableView == dropdownTable
- { sectiontitle = "Select A Job"}
- return sectiontitle
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement