Lor*_*ion 2 storyboard tableview ios swift
我创建了一个ViewController并TableView使用它添加了一个storyboard.
我设置了类在Storyboard为ViewController我的NewsFeedViewController班.我将tableview出口的代表设置为self.
class NewsFeedViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var newsFeedTableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
newsFeedTableView.delegate = self
}
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 5
}
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell =
newsFeedTableView.dequeueReusableCellWithIdentifier(
"newsFeedIphoneCell", forIndexPath: indexPath)
as! NewsFeedIphoneTableViewCell
return cell
}
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
}
}
Run Code Online (Sandbox Code Playgroud)
当我运行代码时,没有触发任何委托方法.我究竟做错了什么?
| 归档时间: |
|
| 查看次数: |
2669 次 |
| 最近记录: |