Skip to content

Instantly share code, notes, and snippets.

@MP0w
Created June 2, 2014 21:22
Show Gist options
  • Save MP0w/75f70ff1d7287f31e22a to your computer and use it in GitHub Desktop.
Save MP0w/75f70ff1d7287f31e22a to your computer and use it in GitHub Desktop.
Already hating it
//
// ViewController.swift
// testSwift
//
// Created by Alex Manzella on 02/06/14.
// Copyright (c) 2014 mpow. All rights reserved.
//
import UIKit
class ViewController: UIViewController , UITableViewDelegate , UITableViewDataSource {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
var table=UITableView(frame: self.view.bounds)
table.delegate=self
table.dataSource=self
self.view.addSubview(table)
}
func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int{
return 10
}
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell!{
let cellId = "cellid"
var cell : AnyObject? = tableView!.dequeueReusableCellWithIdentifier(cellId)
if cell==nil{
cell=UITableViewCell(style: UITableViewCellStyle.Default, reuseIdentifier: cellId)
}
(cell as UITableViewCell).textLabel!.text=String(indexPath.row)
return cell as UITableViewCell
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment