【发布时间】:2016-04-13 18:27:30
【问题描述】:
这是我第一次使用 TableView,我已经遇到了障碍。
我有一个视图控制器,里面有一个容器。 Container View 有一个嵌入的 Table View Controller。我已经使用下面的代码填充了表格视图控制器。我已将数据源和委托设置为表视图控制器,将表视图控制器的自定义类设置为 ORMTableVC,并将表视图单元格标识符设置为 cellIdentifier。
我的问题是在运行时视图控制器是空白的,我看不到任何表格行或数据。
任何帮助将不胜感激。
import Foundation
import UIKit
class ORMTableVC : UITableViewController {
let cellIdentifier = "cellIdentifier"
var Array = [String]()
override func viewDidLoad() {
super.viewDidLoad()
Array = ["Reps", "Weight", "RPE", "Fatigue", "Potential Max", "Fatigue Weight"]
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return Array.count
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let Cell = tableView.dequeueReusableCellWithIdentifier(cellIdentifier, forIndexPath: indexPath)
Cell.textLabel?.text = Array[indexPath.row]
return Cell
}
}
【问题讨论】:
标签: ios swift uitableview uicontainerview