【发布时间】:2015-10-21 11:20:48
【问题描述】:
static
dynamic
dynamic
dynamic
..
..
dynamic
我有一个包含动态内容的动态表格列表。在列表顶部,我需要一个静态单元格。
并尝试在我的静态单元格中添加标签以尝试功能。
我的静态单元格的标识符是:firstCell
动态单元格的标识符是:单元格
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
// #warning Potentially incomplete method implementation.
// Return the number of sections.
return 1
}
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// #warning Incomplete method implementation.
// Return the number of rows in the section.
return 5
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! UITableViewCell
// Configure the cell...
cell.textLabel?.text = "test"
return cell
}
此代码在我的动态单元格中返回 5 次“测试”。当我尝试添加标签并使用静态单元格创建插座时,出现错误。
我已经在 stackoverflow 上进行了谷歌搜索,但没有快速版本的解决方案。怎么能这样?
编辑以改进问题:
实际上我需要两个部分,部分 1 将是静态内容(我将以编程方式创建它。例如,将使用 uidatepicker、uipicker 等),部分 2 将只使用动态数组(这部分很好)
【问题讨论】:
-
你是什么意思静态?你想添加一个节标题还是你想要实现的目标?
标签: ios swift uitableview