Created
September 21, 2015 16:05
Revisions
-
agnosticdev created this gist
Sep 21, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,42 @@ import UIKit class MyViewController: UIViewController,UITableViewDelegate,UITableViewDataSource { var tableData: [String] = ["Table Item One", "Table Item Two"] var tableViewLocal: UITableView! override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view, typically from a nib. self.tableViewLocal = UITableView(); self.tableViewLocal.frame = CGRectMake(0, 0, 320, 500); self.tableViewLocal.delegate = self self.tableViewLocal.dataSource = self; //self.tableViewLocal.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell") self.view.addSubview(tableViewLocal) } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } func numberOfSectionsInTableView(tableView: UITableView) -> Int { return 1 } func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return self.tableData.count; } func tableView(tableView: UITableView,cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let cell:UITableViewCell = UITableViewCell(style:UITableViewCellStyle.Default, reuseIdentifier:"Cell") cell.textLabel?.text = self.tableData[indexPath.row] return cell } }