Skip to content

Instantly share code, notes, and snippets.

@diederikh
Created October 31, 2014 21:52
Show Gist options
  • Save diederikh/17671de8bf86339d8378 to your computer and use it in GitHub Desktop.
Save diederikh/17671de8bf86339d8378 to your computer and use it in GitHub Desktop.
table testje
class ViewController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return 5
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 5
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("MyCell", forIndexPath: indexPath) as UITableViewCell
return cell
}
override func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: 768, height: 44))
let label = UILabel()
label.text = "Header \(section)"
label.frame = view.bounds
label.textAlignment = .Center
view.addSubview(label)
return view
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment