Created
June 2, 2014 21:22
-
-
Save MP0w/75f70ff1d7287f31e22a to your computer and use it in GitHub Desktop.
Already hating it
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
// | |
// 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