Created
August 17, 2016 18:09
-
-
Save ermst4r/fb29c4ec3265ea6192b8d951fd162500 to your computer and use it in GitHub Desktop.
CustomCell.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CustomCell.swift | |
// cheapveilingen | |
// | |
// Created by Erwin Nandpersad on 17-07-16. | |
// Copyright © 2016 Cheapveilingen.nl. All rights reserved. | |
// | |
import UIKit | |
import SocketIOClientSwift | |
class CustomCell: UITableViewCell { | |
var indexPath = 0 | |
@IBOutlet var veiling_title: UITextView! | |
@IBOutlet var photo: UIImageView! | |
@IBOutlet var veilingSeconds: UILabel! | |
var timeInterval: Int = 0 { | |
didSet { | |
self.veilingSeconds.text = "\(timeInterval)" | |
callback?(timeInterval) | |
} | |
} | |
var callback : ((Int) -> ())? | |
func updateUI() { | |
if self.timeInterval > 0 { | |
self.timeInterval -= 1 | |
} | |
} | |
override func awakeFromNib() { | |
super.awakeFromNib() | |
// Initialization code | |
let notificationCenter = NSNotificationCenter.defaultCenter() | |
notificationCenter.addObserver(self, selector: #selector(CustomCell.updateUI), name: "CustomCellUpdate", object: nil) | |
} | |
deinit { | |
NSNotificationCenter.defaultCenter().removeObserver(self) | |
} | |
override func setSelected(selected: Bool, animated: Bool) { | |
super.setSelected(selected, animated: animated) | |
// Configure the view for the selected state | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment