Skip to content

Instantly share code, notes, and snippets.

@anefkens
Created May 20, 2015 09:35
Show Gist options
  • Save anefkens/39b426c9665b5289389f to your computer and use it in GitHub Desktop.
Save anefkens/39b426c9665b5289389f to your computer and use it in GitHub Desktop.
DemoTableViewDelegate
import UIKit
class ClaimsOverViewViewController: UIViewController, UITableViewDataSource
{
@IBOutlet var claimsTableView: UITableView!
let cellID = "Cell"
let claims: NSArray = ["Claim1", "Claim2", "Claim3"]
@IBOutlet var dataTV: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
dataTV.registerClass(UITableViewCell.classForCoder(), forCellReuseIdentifier: cellID)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
extension ClaimsOverViewViewController: UITableViewDataSource
{
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
return self.claims.count
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
let cell = tableView.dequeueReusableCellWithIdentifier(cellID) as! UITableViewCell
cell.textLabel?.text = self.claims[indexPath.row] as? String
return cell
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment