-
-
Save benjamingr/a9125a17147ab21e6c30 to your computer and use it in GitHub Desktop.
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
import Foundation | |
import UIKit | |
class MyHomeView : UIView { | |
var stockTable:UITableView! | |
override init(frame:CGRect){ | |
super.init(frame:frame) | |
stockTable = UITableView(frame: frame,style: UITableViewStyle.Plain) | |
stockTable.delegate = HomePageStockListCommands() | |
stockTable.dataSource = HomePageStockListSource() | |
stockTable.rowHeight = 45 | |
stockTable.sectionFooterHeight = 0 | |
stockTable.sectionHeaderHeight = 0 | |
stockTable.scrollEnabled = true | |
stockTable.showsVerticalScrollIndicator = true | |
stockTable.userInteractionEnabled = true | |
stockTable.bounces = true | |
self.addSubview(self.stockTable) // this causes an EXC_BAD_ACCESS | |
} | |
} | |
class HomePageStockListCommands: NSObject, UITableViewDelegate { | |
} | |
class HomePageStockListSource : NSObject, UITableViewDataSource { | |
func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int { | |
print("Request for size") // does not get printed | |
return 1 | |
} | |
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! { | |
print("Request for cell") // does not get printed | |
let cell = UITableViewCell() | |
println(cell.textLabel) | |
cell.textLabel.text = "MSFT" | |
return cell | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment